Update
This commit is contained in:
parent
08cf6729ae
commit
13f2f75acf
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# eslint-rules
|
||||
|
||||
## flat config support
|
||||
|
||||
- ❌ [import](https://github.com/import-js/eslint-plugin-import/issues/2556)
|
||||
- ✅ [react](https://github.com/jsx-eslint/eslint-plugin-react/pull/3429)
|
||||
- 🇵🇷 [a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/pull/891)
|
2
dist/basic.d.ts
vendored
2
dist/basic.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
import type { ESLintConfig } from 'eslint-define-config';
|
||||
export declare function extendConfig({ plugins, settings, rules, ...config }: ESLintConfig): ESLintConfig;
|
||||
export declare function extendConfig({ plugins, settings, rules, extends: _extends, ...rest }: ESLintConfig): ESLintConfig;
|
||||
|
2
dist/package.json
vendored
2
dist/package.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aet/eslint-rules",
|
||||
"version": "0.0.1-beta.17",
|
||||
"version": "0.0.1-beta.21",
|
||||
"license": "UNLICENSED",
|
||||
"peerDependencies": {
|
||||
"typescript": "^5.1.6"
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@aet/eslint-configs",
|
||||
"scripts": {
|
||||
"build": "./esbuild.ts",
|
||||
"build": "./build.sh",
|
||||
"check-import": "for js in dist/*.js; do cat $js | grep 'require('; done"
|
||||
},
|
||||
"private": true,
|
||||
@ -27,6 +27,7 @@
|
||||
"eslint-config-prettier": "8.8.0",
|
||||
"eslint-define-config": "^1.21.0",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-unicorn": "^48.0.1",
|
||||
"glob": "^10.3.3",
|
||||
"json-schema-to-ts": "^2.9.1",
|
||||
"lodash": "^4.17.21",
|
||||
|
@ -26,10 +26,10 @@ index 883c03b7..0111d616 100644
|
||||
}
|
||||
diff --git a/.eslintrc b/.eslintrc
|
||||
deleted file mode 100644
|
||||
index 709a4744..00000000
|
||||
index 932055e8..00000000
|
||||
--- a/.eslintrc
|
||||
+++ /dev/null
|
||||
@@ -1,247 +0,0 @@
|
||||
@@ -1,248 +0,0 @@
|
||||
-{
|
||||
- "root": true,
|
||||
- "plugins": [
|
||||
@ -51,6 +51,7 @@ index 709a4744..00000000
|
||||
- "ecmaVersion": 2020,
|
||||
- },
|
||||
- "rules": {
|
||||
- "array-bracket-spacing": [2, "never"],
|
||||
- "arrow-body-style": [2, "as-needed"],
|
||||
- "arrow-parens": [2, "always"],
|
||||
- "arrow-spacing": [2, { "before": true, "after": true }],
|
||||
@ -607,3 +608,15 @@ index feafba90..9a464041 100644
|
||||
+ )
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/rules/imports-first.js b/src/rules/imports-first.js
|
||||
index 966367e9..3881d383 100644
|
||||
--- a/src/rules/imports-first.js
|
||||
+++ b/src/rules/imports-first.js
|
||||
@@ -1,6 +1,6 @@
|
||||
import docsUrl from '../docsUrl';
|
||||
|
||||
-const first = require('./first');
|
||||
+import first from './first';
|
||||
|
||||
const newMeta = {
|
||||
...first.meta,
|
||||
|
@ -211,7 +211,7 @@ index a1bb4811..db051356 100644
|
||||
const docsUrl = require('../util/docsUrl');
|
||||
const jsxUtil = require('../util/jsx');
|
||||
diff --git a/lib/rules/jsx-sort-props.js b/lib/rules/jsx-sort-props.js
|
||||
index 5de5bee1..8013a8de 100644
|
||||
index 6d19f201..4b1849cc 100644
|
||||
--- a/lib/rules/jsx-sort-props.js
|
||||
+++ b/lib/rules/jsx-sort-props.js
|
||||
@@ -5,7 +5,7 @@
|
||||
@ -284,7 +284,7 @@ index 55073bfe..efc07af1 100644
|
||||
const astUtil = require('./ast');
|
||||
const isCreateElement = require('./isCreateElement');
|
||||
diff --git a/package.json b/package.json
|
||||
index b1fa86fa..758b2177 100644
|
||||
index e37bae08..5bfa4b9f 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -25,21 +25,13 @@
|
||||
|
@ -71,12 +71,12 @@ index 0f1cd04..bfed363 100644
|
||||
+export { hasProp } from './src';
|
||||
\ No newline at end of file
|
||||
diff --git a/package.json b/package.json
|
||||
index 40f7947..4759eca 100644
|
||||
index f77b766..3e6d321 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "jsx-ast-utils",
|
||||
"version": "3.3.4",
|
||||
"version": "3.3.5",
|
||||
"description": "AST utility module for statically analyzing JSX",
|
||||
- "main": "lib/index.js",
|
||||
+ "main": "src/index.js",
|
||||
|
224
pnpm-lock.yaml
generated
224
pnpm-lock.yaml
generated
@ -68,6 +68,9 @@ devDependencies:
|
||||
eslint-plugin-import:
|
||||
specifier: ^2.27.5
|
||||
version: 2.27.5(eslint@8.45.0)
|
||||
eslint-plugin-unicorn:
|
||||
specifier: ^48.0.1
|
||||
version: 48.0.1(eslint@8.45.0)
|
||||
glob:
|
||||
specifier: ^10.3.3
|
||||
version: 10.3.3
|
||||
@ -1756,6 +1759,10 @@ packages:
|
||||
resolution: {integrity: sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==}
|
||||
dev: true
|
||||
|
||||
/@types/normalize-package-data@2.4.1:
|
||||
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
|
||||
dev: true
|
||||
|
||||
/@types/parse-json@4.0.0:
|
||||
resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==}
|
||||
dev: true
|
||||
@ -1941,6 +1948,11 @@ packages:
|
||||
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
|
||||
dev: true
|
||||
|
||||
/builtin-modules@3.3.0:
|
||||
resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/call-bind@1.0.2:
|
||||
resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==}
|
||||
dependencies:
|
||||
@ -1974,6 +1986,18 @@ packages:
|
||||
supports-color: 7.2.0
|
||||
dev: true
|
||||
|
||||
/ci-info@3.8.0:
|
||||
resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/clean-regexp@1.0.0:
|
||||
resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
escape-string-regexp: 1.0.5
|
||||
dev: true
|
||||
|
||||
/cliui@8.0.1:
|
||||
resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}
|
||||
engines: {node: '>=12'}
|
||||
@ -2342,6 +2366,30 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-unicorn@48.0.1(eslint@8.45.0):
|
||||
resolution: {integrity: sha512-FW+4r20myG/DqFcCSzoumaddKBicIPeFnTrifon2mWIzlfyvzwyqZjqVP7m4Cqr/ZYisS2aiLghkUWaPg6vtCw==}
|
||||
engines: {node: '>=16'}
|
||||
peerDependencies:
|
||||
eslint: '>=8.44.0'
|
||||
dependencies:
|
||||
'@babel/helper-validator-identifier': 7.22.5
|
||||
'@eslint-community/eslint-utils': 4.4.0(eslint@8.45.0)
|
||||
ci-info: 3.8.0
|
||||
clean-regexp: 1.0.0
|
||||
eslint: 8.45.0
|
||||
esquery: 1.5.0
|
||||
indent-string: 4.0.0
|
||||
is-builtin-module: 3.2.1
|
||||
jsesc: 3.0.2
|
||||
lodash: 4.17.21
|
||||
pluralize: 8.0.0
|
||||
read-pkg-up: 7.0.1
|
||||
regexp-tree: 0.1.27
|
||||
regjsparser: 0.10.0
|
||||
semver: 7.5.4
|
||||
strip-indent: 3.0.0
|
||||
dev: true
|
||||
|
||||
/eslint-scope@7.2.0:
|
||||
resolution: {integrity: sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
@ -2459,6 +2507,14 @@ packages:
|
||||
flat-cache: 3.0.4
|
||||
dev: true
|
||||
|
||||
/find-up@4.1.0:
|
||||
resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
locate-path: 5.0.0
|
||||
path-exists: 4.0.0
|
||||
dev: true
|
||||
|
||||
/find-up@5.0.0:
|
||||
resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
|
||||
engines: {node: '>=10'}
|
||||
@ -2645,6 +2701,10 @@ packages:
|
||||
function-bind: 1.1.1
|
||||
dev: true
|
||||
|
||||
/hosted-git-info@2.8.9:
|
||||
resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==}
|
||||
dev: true
|
||||
|
||||
/ignore@5.2.4:
|
||||
resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==}
|
||||
engines: {node: '>= 4'}
|
||||
@ -2663,6 +2723,11 @@ packages:
|
||||
engines: {node: '>=0.8.19'}
|
||||
dev: true
|
||||
|
||||
/indent-string@4.0.0:
|
||||
resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/inflight@1.0.6:
|
||||
resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
|
||||
dependencies:
|
||||
@ -2709,6 +2774,13 @@ packages:
|
||||
has-tostringtag: 1.0.0
|
||||
dev: true
|
||||
|
||||
/is-builtin-module@3.2.1:
|
||||
resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==}
|
||||
engines: {node: '>=6'}
|
||||
dependencies:
|
||||
builtin-modules: 3.3.0
|
||||
dev: true
|
||||
|
||||
/is-callable@1.2.7:
|
||||
resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@ -2846,6 +2918,12 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/jsesc@3.0.2:
|
||||
resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==}
|
||||
engines: {node: '>=6'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/json-parse-even-better-errors@2.3.1:
|
||||
resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
|
||||
dev: true
|
||||
@ -2892,6 +2970,13 @@ packages:
|
||||
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
|
||||
dev: true
|
||||
|
||||
/locate-path@5.0.0:
|
||||
resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
p-locate: 4.1.0
|
||||
dev: true
|
||||
|
||||
/locate-path@6.0.0:
|
||||
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
|
||||
engines: {node: '>=10'}
|
||||
@ -2917,11 +3002,23 @@ packages:
|
||||
yallist: 3.1.1
|
||||
dev: true
|
||||
|
||||
/lru-cache@6.0.0:
|
||||
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
yallist: 4.0.0
|
||||
dev: true
|
||||
|
||||
/lru-cache@9.1.1:
|
||||
resolution: {integrity: sha512-65/Jky17UwSb0BuB9V+MyDpsOtXKmYwzhyl+cOa9XUiI4uV2Ouy/2voFP3+al0BjZbJgMBD8FojMpAf+Z+qn4A==}
|
||||
engines: {node: 14 || >=16.14}
|
||||
dev: true
|
||||
|
||||
/min-indent@1.0.1:
|
||||
resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/minimatch@3.1.2:
|
||||
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
|
||||
dependencies:
|
||||
@ -2956,6 +3053,15 @@ packages:
|
||||
resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==}
|
||||
dev: true
|
||||
|
||||
/normalize-package-data@2.5.0:
|
||||
resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==}
|
||||
dependencies:
|
||||
hosted-git-info: 2.8.9
|
||||
resolve: 1.22.2
|
||||
semver: 5.7.2
|
||||
validate-npm-package-license: 3.0.4
|
||||
dev: true
|
||||
|
||||
/object-inspect@1.12.3:
|
||||
resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==}
|
||||
dev: true
|
||||
@ -3002,6 +3108,13 @@ packages:
|
||||
type-check: 0.4.0
|
||||
dev: true
|
||||
|
||||
/p-limit@2.3.0:
|
||||
resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
|
||||
engines: {node: '>=6'}
|
||||
dependencies:
|
||||
p-try: 2.2.0
|
||||
dev: true
|
||||
|
||||
/p-limit@3.1.0:
|
||||
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
|
||||
engines: {node: '>=10'}
|
||||
@ -3009,6 +3122,13 @@ packages:
|
||||
yocto-queue: 0.1.0
|
||||
dev: true
|
||||
|
||||
/p-locate@4.1.0:
|
||||
resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
p-limit: 2.3.0
|
||||
dev: true
|
||||
|
||||
/p-locate@5.0.0:
|
||||
resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
|
||||
engines: {node: '>=10'}
|
||||
@ -3016,6 +3136,11 @@ packages:
|
||||
p-limit: 3.1.0
|
||||
dev: true
|
||||
|
||||
/p-try@2.2.0:
|
||||
resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/parent-module@1.0.1:
|
||||
resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}
|
||||
engines: {node: '>=6'}
|
||||
@ -3074,6 +3199,11 @@ packages:
|
||||
engines: {node: '>= 6'}
|
||||
dev: true
|
||||
|
||||
/pluralize@8.0.0:
|
||||
resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/prelude-ls@1.2.1:
|
||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
@ -3094,6 +3224,25 @@ packages:
|
||||
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
|
||||
dev: true
|
||||
|
||||
/read-pkg-up@7.0.1:
|
||||
resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
find-up: 4.1.0
|
||||
read-pkg: 5.2.0
|
||||
type-fest: 0.8.1
|
||||
dev: true
|
||||
|
||||
/read-pkg@5.2.0:
|
||||
resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
'@types/normalize-package-data': 2.4.1
|
||||
normalize-package-data: 2.5.0
|
||||
parse-json: 5.2.0
|
||||
type-fest: 0.6.0
|
||||
dev: true
|
||||
|
||||
/regenerate-unicode-properties@10.1.0:
|
||||
resolution: {integrity: sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==}
|
||||
engines: {node: '>=4'}
|
||||
@ -3115,6 +3264,11 @@ packages:
|
||||
'@babel/runtime': 7.21.5
|
||||
dev: true
|
||||
|
||||
/regexp-tree@0.1.27:
|
||||
resolution: {integrity: sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/regexp.prototype.flags@1.5.0:
|
||||
resolution: {integrity: sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@ -3136,6 +3290,13 @@ packages:
|
||||
unicode-match-property-value-ecmascript: 2.1.0
|
||||
dev: true
|
||||
|
||||
/regjsparser@0.10.0:
|
||||
resolution: {integrity: sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
jsesc: 0.5.0
|
||||
dev: true
|
||||
|
||||
/regjsparser@0.9.1:
|
||||
resolution: {integrity: sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==}
|
||||
hasBin: true
|
||||
@ -3188,11 +3349,24 @@ packages:
|
||||
is-regex: 1.1.4
|
||||
dev: true
|
||||
|
||||
/semver@5.7.2:
|
||||
resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/semver@6.3.1:
|
||||
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/semver@7.5.4:
|
||||
resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
lru-cache: 6.0.0
|
||||
dev: true
|
||||
|
||||
/shebang-command@2.0.0:
|
||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||
engines: {node: '>=8'}
|
||||
@ -3235,6 +3409,28 @@ packages:
|
||||
engines: {node: '>= 8'}
|
||||
dev: true
|
||||
|
||||
/spdx-correct@3.2.0:
|
||||
resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==}
|
||||
dependencies:
|
||||
spdx-expression-parse: 3.0.1
|
||||
spdx-license-ids: 3.0.13
|
||||
dev: true
|
||||
|
||||
/spdx-exceptions@2.3.0:
|
||||
resolution: {integrity: sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==}
|
||||
dev: true
|
||||
|
||||
/spdx-expression-parse@3.0.1:
|
||||
resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==}
|
||||
dependencies:
|
||||
spdx-exceptions: 2.3.0
|
||||
spdx-license-ids: 3.0.13
|
||||
dev: true
|
||||
|
||||
/spdx-license-ids@3.0.13:
|
||||
resolution: {integrity: sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==}
|
||||
dev: true
|
||||
|
||||
/string-width@4.2.3:
|
||||
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
|
||||
engines: {node: '>=8'}
|
||||
@ -3297,6 +3493,13 @@ packages:
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/strip-indent@3.0.0:
|
||||
resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
min-indent: 1.0.1
|
||||
dev: true
|
||||
|
||||
/strip-json-comments@3.1.1:
|
||||
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
|
||||
engines: {node: '>=8'}
|
||||
@ -3364,6 +3567,16 @@ packages:
|
||||
engines: {node: '>=10'}
|
||||
dev: true
|
||||
|
||||
/type-fest@0.6.0:
|
||||
resolution: {integrity: sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/type-fest@0.8.1:
|
||||
resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/typed-array-length@1.0.4:
|
||||
resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==}
|
||||
dependencies:
|
||||
@ -3427,6 +3640,13 @@ packages:
|
||||
punycode: 2.3.0
|
||||
dev: true
|
||||
|
||||
/validate-npm-package-license@3.0.4:
|
||||
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
|
||||
dependencies:
|
||||
spdx-correct: 3.2.0
|
||||
spdx-expression-parse: 3.0.1
|
||||
dev: true
|
||||
|
||||
/which-boxed-primitive@1.0.2:
|
||||
resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==}
|
||||
dependencies:
|
||||
@ -3488,6 +3708,10 @@ packages:
|
||||
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
|
||||
dev: true
|
||||
|
||||
/yallist@4.0.0:
|
||||
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
|
||||
dev: true
|
||||
|
||||
/yaml@1.10.2:
|
||||
resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==}
|
||||
engines: {node: '>= 6'}
|
||||
|
194
src/basic.ts
194
src/basic.ts
@ -1,38 +1,56 @@
|
||||
// @ts-check
|
||||
import type { ESLintConfig } from 'eslint-define-config';
|
||||
|
||||
function unique<T>(arr: T[]): T[] {
|
||||
return [...new Set(arr)];
|
||||
}
|
||||
|
||||
const error = 'error';
|
||||
const warn = 'warn';
|
||||
const off = 'off';
|
||||
|
||||
export function extendConfig({
|
||||
plugins,
|
||||
settings,
|
||||
rules,
|
||||
...config
|
||||
extends: _extends,
|
||||
...rest
|
||||
}: ESLintConfig): ESLintConfig {
|
||||
return {
|
||||
const hasReact = plugins?.includes('react');
|
||||
const hasUnicorn = plugins?.includes('unicorn');
|
||||
|
||||
const result: ESLintConfig = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint', 'import', ...(plugins ?? [])],
|
||||
env: { node: true, browser: true },
|
||||
plugins: unique(['@typescript-eslint', 'import', ...(plugins ?? [])]),
|
||||
env: { node: true, browser: true, es2023: true },
|
||||
reportUnusedDisableDirectives: true,
|
||||
parserOptions: { project: ['./tsconfig.json'] },
|
||||
extends: [
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
},
|
||||
extends: unique([
|
||||
'eslint:recommended',
|
||||
'prettier',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended-type-checked',
|
||||
'plugin:import/errors',
|
||||
'plugin:import/typescript',
|
||||
...(hasReact
|
||||
? [
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'plugin:jsx-a11y/recommended',
|
||||
],
|
||||
]
|
||||
: []),
|
||||
...(hasUnicorn ? ['plugin:unicorn/recommended'] : []),
|
||||
...(_extends ?? []),
|
||||
]),
|
||||
settings: {
|
||||
'import/parsers': {
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx', '.mts', '.cts'],
|
||||
},
|
||||
'import/core-modules': ['node:test'],
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
alwaysTryTypes: true,
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
},
|
||||
react: {
|
||||
@ -41,9 +59,9 @@ export function extendConfig({
|
||||
...settings,
|
||||
},
|
||||
rules: {
|
||||
'no-duplicate-imports': 'error',
|
||||
'no-duplicate-imports': error,
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
error,
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
@ -54,78 +72,104 @@ export function extendConfig({
|
||||
],
|
||||
},
|
||||
],
|
||||
'no-restricted-globals': ['error', 'event', 'name'],
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'no-restricted-globals': [error, 'event', 'name', 'length'],
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
error,
|
||||
{
|
||||
'ts-expect-error': 'allow-with-description',
|
||||
'ts-check': false,
|
||||
'ts-ignore': 'allow-with-description',
|
||||
'ts-nocheck': 'allow-with-description',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/consistent-type-imports': [
|
||||
'error',
|
||||
error,
|
||||
{ disallowTypeAnnotations: false, fixStyle: 'inline-type-imports' },
|
||||
],
|
||||
'@typescript-eslint/ban-types': [
|
||||
'error',
|
||||
{
|
||||
extendDefaults: false,
|
||||
types: {
|
||||
String: { message: 'Use string instead', fixWith: 'string' },
|
||||
Number: { message: 'Use number instead', fixWith: 'number' },
|
||||
Boolean: { message: 'Use boolean instead', fixWith: 'boolean' },
|
||||
Symbol: { message: 'Use symbol instead', fixWith: 'symbol' },
|
||||
},
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-namespace': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
'@typescript-eslint/triple-slash-reference': 'off',
|
||||
'@typescript-eslint/no-empty-interface': 'off',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||
'@typescript-eslint/ban-types': [error, { extendDefaults: true }],
|
||||
'@typescript-eslint/no-empty-interface': [error, { allowSingleExtends: true }],
|
||||
'@typescript-eslint/no-explicit-any': off,
|
||||
'@typescript-eslint/no-extraneous-class': error,
|
||||
'@typescript-eslint/no-namespace': off,
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': error,
|
||||
'@typescript-eslint/no-unsafe-argument': off,
|
||||
'@typescript-eslint/no-unsafe-assignment': off,
|
||||
'@typescript-eslint/no-unsafe-member-access': off,
|
||||
'@typescript-eslint/no-unsafe-call': off,
|
||||
'@typescript-eslint/no-unsafe-return': off,
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
error,
|
||||
{ ignoreRestSiblings: true, varsIgnorePattern: '^_' },
|
||||
],
|
||||
'arrow-body-style': ['error', 'as-needed'],
|
||||
'class-methods-use-this': 'off',
|
||||
complexity: ['warn', { max: 100 }],
|
||||
curly: ['error', 'multi-line', 'consistent'],
|
||||
eqeqeq: ['error', 'smart'],
|
||||
'no-async-promise-executor': 'off',
|
||||
'no-case-declarations': 'off',
|
||||
'no-console': 'warn',
|
||||
'no-constant-condition': ['error', { checkLoops: false }],
|
||||
'no-debugger': 'off',
|
||||
'no-empty': ['error', { allowEmptyCatch: true }],
|
||||
'no-inner-declarations': 'off',
|
||||
'no-lonely-if': 'error',
|
||||
'no-template-curly-in-string': 'error',
|
||||
'no-var': 'error',
|
||||
'import/export': 'off',
|
||||
'import/order': ['error', { groups: ['builtin', 'external'] }],
|
||||
'object-shorthand': ['error', 'always', { ignoreConstructors: true }],
|
||||
'one-var': ['error', { var: 'never', let: 'never' }],
|
||||
'prefer-arrow-callback': 'error',
|
||||
'prefer-const': ['error', { destructuring: 'all' }],
|
||||
'@typescript-eslint/no-use-before-define': off,
|
||||
'@typescript-eslint/no-var-requires': off,
|
||||
'@typescript-eslint/unbound-method': off,
|
||||
'@typescript-eslint/triple-slash-reference': off,
|
||||
'arrow-body-style': [error, 'as-needed'],
|
||||
'class-methods-use-this': off,
|
||||
complexity: [warn, { max: 100 }],
|
||||
curly: [error, 'multi-line', 'consistent'],
|
||||
eqeqeq: [error, 'smart'],
|
||||
'no-async-promise-executor': off,
|
||||
'no-case-declarations': off,
|
||||
'no-console': warn,
|
||||
'no-constant-condition': [error, { checkLoops: false }],
|
||||
'no-debugger': warn,
|
||||
'no-empty': [error, { allowEmptyCatch: true }],
|
||||
'no-inner-declarations': off,
|
||||
'no-lonely-if': error,
|
||||
'no-template-curly-in-string': error,
|
||||
'no-var': error,
|
||||
'import/export': off,
|
||||
'import/order': [error, { groups: ['builtin', 'external'] }],
|
||||
'object-shorthand': [error, 'always', { ignoreConstructors: true }],
|
||||
'one-var': [error, { var: 'never', let: 'never' }],
|
||||
'prefer-arrow-callback': error,
|
||||
'prefer-const': [error, { destructuring: 'all' }],
|
||||
'prefer-destructuring': [
|
||||
'warn',
|
||||
warn,
|
||||
{ AssignmentExpression: { array: false, object: false } },
|
||||
],
|
||||
'prefer-object-spread': 'error',
|
||||
'prefer-rest-params': 'warn',
|
||||
'prefer-spread': 'warn',
|
||||
'quote-props': ['error', 'as-needed'],
|
||||
'spaced-comment': ['error', 'always', { markers: ['/'] }],
|
||||
'sort-imports': ['warn', { ignoreDeclarationSort: true }],
|
||||
yoda: ['error', 'never', { exceptRange: true }],
|
||||
'react/display-name': 'off',
|
||||
'react/no-children-prop': 'error',
|
||||
'react/prop-types': 'off',
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/no-unknown-property': ['error', { ignore: ['css'] }],
|
||||
'prefer-object-spread': error,
|
||||
'prefer-rest-params': warn,
|
||||
'prefer-spread': warn,
|
||||
'quote-props': [error, 'as-needed'],
|
||||
'spaced-comment': [error, 'always', { markers: ['/'] }],
|
||||
'sort-imports': [warn, { ignoreDeclarationSort: true }],
|
||||
yoda: [error, 'never', { exceptRange: true }],
|
||||
...(hasReact
|
||||
? {
|
||||
'react/display-name': off,
|
||||
'react/no-children-prop': error,
|
||||
'react/prop-types': off,
|
||||
'react/react-in-jsx-scope': off,
|
||||
'react/no-unknown-property': [error, { ignore: ['css'] }],
|
||||
}
|
||||
: {}),
|
||||
...(hasUnicorn
|
||||
? {
|
||||
'unicorn/no-abusive-eslint-disable': off,
|
||||
'unicorn/no-array-callback-reference': off,
|
||||
'unicorn/no-array-for-each': warn,
|
||||
'unicorn/no-array-reduce': off,
|
||||
'unicorn/no-await-expression-member': off,
|
||||
'unicorn/no-empty-file': off,
|
||||
'unicorn/no-negated-condition': warn,
|
||||
'unicorn/no-new-array': off,
|
||||
'unicorn/no-null': off,
|
||||
'unicorn/no-process-exit': off,
|
||||
'unicorn/no-this-assignment': off,
|
||||
'unicorn/prefer-module': off,
|
||||
'unicorn/prefer-string-replace-all': off,
|
||||
'unicorn/prefer-top-level-await': off,
|
||||
'unicorn/throw-new-error': off,
|
||||
'unicorn/no-unnecessary-await': off,
|
||||
}
|
||||
: {}),
|
||||
...rules,
|
||||
},
|
||||
...config,
|
||||
...rest,
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
import type { Rule } from 'eslint';
|
||||
|
||||
import noImportDot from "./no-import-dot";
|
||||
import requireNodePrefix from "./require-node-prefix"
|
||||
import noImportDot from "./no-import-dot"
|
||||
|
||||
export const rules: Record<string, Rule.RuleModule> = {
|
||||
"no-import-dot": noImportDot,
|
||||
"require-node-prefix": requireNodePrefix
|
||||
"no-import-dot": noImportDot
|
||||
};
|
@ -1,36 +0,0 @@
|
||||
// @ts-check
|
||||
import { builtinModules } from "node:module";
|
||||
import type { Rule } from "eslint";
|
||||
|
||||
const rule: Rule.RuleModule = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
docs: {
|
||||
description:
|
||||
"Disallow imports of built-in Node.js modules without the `node:` prefix",
|
||||
category: "Best Practices",
|
||||
recommended: true,
|
||||
},
|
||||
fixable: "code",
|
||||
schema: [],
|
||||
},
|
||||
create: context => ({
|
||||
ImportDeclaration(node) {
|
||||
const { source } = node;
|
||||
|
||||
if (source?.type === "Literal" && typeof source.value === "string") {
|
||||
const moduleName = source.value;
|
||||
|
||||
if (builtinModules.includes(moduleName) && !moduleName.startsWith("node:")) {
|
||||
context.report({
|
||||
node: source,
|
||||
message: `Import of built-in Node.js module "${moduleName}" must use the "node:" prefix.`,
|
||||
fix: fixer => fixer.replaceText(source, `"node:${moduleName}"`),
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
export default rule;
|
Loading…
x
Reference in New Issue
Block a user