Update
This commit is contained in:
parent
aeb69e38dc
commit
198c731cbb
5
dist/index.d.ts
vendored
5
dist/index.d.ts
vendored
@ -1,2 +1,7 @@
|
|||||||
import type { ESLintConfig } from 'eslint-define-config';
|
import type { ESLintConfig } from 'eslint-define-config';
|
||||||
|
declare module 'eslint-define-config/src/rules/react/no-unknown-property.d.ts' {
|
||||||
|
interface NoUnknownPropertyOption {
|
||||||
|
extends: ('next' | 'emotion')[];
|
||||||
|
}
|
||||||
|
}
|
||||||
export declare function extendConfig({ plugins, settings, rules, extends: _extends, ...rest }: ESLintConfig): ESLintConfig;
|
export declare function extendConfig({ plugins, settings, rules, extends: _extends, ...rest }: ESLintConfig): ESLintConfig;
|
||||||
|
16
dist/package.json
vendored
16
dist/package.json
vendored
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "@aet/eslint-rules",
|
"name": "@aet/eslint-rules",
|
||||||
"version": "0.0.1-beta.23",
|
"version": "0.0.1-beta.26",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.1.6"
|
"typescript": "^5.1.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/eslint": "^8.44.1",
|
"@types/eslint": "^8.44.2",
|
||||||
"@typescript-eslint/eslint-plugin": "6.2.1",
|
"@typescript-eslint/eslint-plugin": "6.3.0",
|
||||||
"@typescript-eslint/parser": "6.2.1",
|
"@typescript-eslint/parser": "6.3.0",
|
||||||
"aria-query": "^5.3.0",
|
"aria-query": "^5.3.0",
|
||||||
"axe-core": "4.7.2",
|
"axe-core": "4.7.2",
|
||||||
"axobject-query": "^3.2.1",
|
"axobject-query": "^3.2.1",
|
||||||
@ -16,13 +16,13 @@
|
|||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"doctrine": "^3.0.0",
|
"doctrine": "^3.0.0",
|
||||||
"emoji-regex": "^10.2.1",
|
"emoji-regex": "^10.2.1",
|
||||||
"eslint-config-prettier": "8.9.0",
|
"eslint-config-prettier": "9.0.0",
|
||||||
"eslint-define-config": "^1.22.0",
|
"eslint-define-config": "^1.23.0",
|
||||||
"eslint-import-resolver-node": "^0.3.7",
|
"eslint-import-resolver-node": "^0.3.9",
|
||||||
"eslint-import-resolver-typescript": "3.5.5",
|
"eslint-import-resolver-typescript": "3.5.5",
|
||||||
"eslint-module-utils": "^2.8.0",
|
"eslint-module-utils": "^2.8.0",
|
||||||
"estraverse": "^5.3.0",
|
"estraverse": "^5.3.0",
|
||||||
"is-core-module": "^2.12.1",
|
"is-core-module": "^2.13.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
"language-tags": "^1.0.8",
|
"language-tags": "^1.0.8",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
10
esbuild.ts
10
esbuild.ts
@ -12,7 +12,6 @@ import type { types as t } from '@babel/core';
|
|||||||
import { dependencies } from './dist/package.json';
|
import { dependencies } from './dist/package.json';
|
||||||
import { createMacro, type MacroHandler } from 'babel-plugin-macros';
|
import { createMacro, type MacroHandler } from 'babel-plugin-macros';
|
||||||
|
|
||||||
const args = process.argv.slice(2);
|
|
||||||
const ENV = process.env.NODE_ENV || 'development';
|
const ENV = process.env.NODE_ENV || 'development';
|
||||||
const PROD = ENV === 'production';
|
const PROD = ENV === 'production';
|
||||||
|
|
||||||
@ -81,6 +80,15 @@ const map = new HandlerMap()
|
|||||||
.set(
|
.set(
|
||||||
'string.prototype.matchall',
|
'string.prototype.matchall',
|
||||||
proto(t => t.identifier('matchAll')),
|
proto(t => t.identifier('matchAll')),
|
||||||
|
)
|
||||||
|
.set(
|
||||||
|
'object.groupby',
|
||||||
|
replace(t =>
|
||||||
|
t.memberExpression(
|
||||||
|
t.callExpression(t.identifier('require'), [t.stringLiteral('lodash')]),
|
||||||
|
t.identifier('groupBy'),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
function replace(getReplacement: (types: typeof t) => t.Expression): MacroHandler {
|
function replace(getReplacement: (types: typeof t) => t.Expression): MacroHandler {
|
||||||
|
19
package.json
19
package.json
@ -6,33 +6,34 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.22.9",
|
"@babel/core": "^7.22.10",
|
||||||
"@babel/plugin-transform-flow-strip-types": "^7.22.5",
|
"@babel/plugin-transform-flow-strip-types": "^7.22.5",
|
||||||
"@babel/preset-env": "^7.22.9",
|
"@babel/preset-env": "^7.22.10",
|
||||||
"@types/babel-plugin-macros": "^3.1.0",
|
"@types/babel-plugin-macros": "^3.1.0",
|
||||||
"@types/babel__core": "^7.20.1",
|
"@types/babel__core": "^7.20.1",
|
||||||
"@types/eslint": "^8.44.1",
|
"@types/eslint": "^8.44.2",
|
||||||
"@types/estree": "^1.0.1",
|
"@types/estree": "^1.0.1",
|
||||||
"@types/estree-jsx": "^1.0.0",
|
"@types/estree-jsx": "^1.0.0",
|
||||||
"@types/lodash": "^4.14.196",
|
"@types/lodash": "^4.14.196",
|
||||||
"@types/node": "^20.4.5",
|
"@types/node": "^20.4.8",
|
||||||
"@typescript-eslint/types": "^6.2.1",
|
"@typescript-eslint/types": "^6.3.0",
|
||||||
"babel-plugin-macros": "^3.1.0",
|
"babel-plugin-macros": "^3.1.0",
|
||||||
"dts-bundle-generator": "^8.0.1",
|
"dts-bundle-generator": "^8.0.1",
|
||||||
"esbin": "0.0.1-beta.2",
|
"esbin": "0.0.1-beta.2",
|
||||||
"esbuild": "0.18.17",
|
"esbuild": "0.18.20",
|
||||||
"esbuild-plugin-alias": "^0.2.1",
|
"esbuild-plugin-alias": "^0.2.1",
|
||||||
"esbuild-register": "3.4.2",
|
"esbuild-register": "3.4.2",
|
||||||
"eslint": "8.46.0",
|
"eslint": "8.46.0",
|
||||||
"eslint-config-prettier": "8.9.0",
|
"eslint-config-prettier": "9.0.0",
|
||||||
"eslint-define-config": "^1.22.0",
|
"eslint-define-config": "^1.23.0",
|
||||||
"eslint-plugin-import": "^2.28.0",
|
"eslint-plugin-import": "^2.28.0",
|
||||||
"eslint-plugin-unicorn": "^48.0.1",
|
"eslint-plugin-unicorn": "^48.0.1",
|
||||||
"glob": "^10.3.3",
|
"glob": "^10.3.3",
|
||||||
"json-schema-to-ts": "^2.9.1",
|
"json-schema-to-ts": "^2.9.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"minimatch": "^9.0.3",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"prettier": "^3.0.0",
|
"prettier": "^3.0.1",
|
||||||
"typescript": "5.1.6"
|
"typescript": "5.1.6"
|
||||||
},
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
|
@ -1,622 +0,0 @@
|
|||||||
diff --git a/.babelrc b/.babelrc
|
|
||||||
index 883c03b7..0111d616 100644
|
|
||||||
--- a/.babelrc
|
|
||||||
+++ b/.babelrc
|
|
||||||
@@ -1,18 +1,11 @@
|
|
||||||
{
|
|
||||||
- "presets": ["airbnb"],
|
|
||||||
- "sourceMaps": "inline",
|
|
||||||
- "retainLines": true,
|
|
||||||
+ "presets": [["@babel/preset-env", { "targets": { "node": 16 } }]],
|
|
||||||
"env": {
|
|
||||||
"test": {
|
|
||||||
- "plugins": [
|
|
||||||
- "istanbul",
|
|
||||||
- ["module-resolver", { "root": ["./src/"] }],
|
|
||||||
- ]
|
|
||||||
+ "plugins": ["istanbul", ["module-resolver", { "root": ["./src/"] }]]
|
|
||||||
},
|
|
||||||
"testCompiled": {
|
|
||||||
- "plugins": [
|
|
||||||
- ["module-resolver", { "root": ["./lib/"] }],
|
|
||||||
- ]
|
|
||||||
+ "plugins": [["module-resolver", { "root": ["./lib/"] }]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/.eslintrc b/.eslintrc
|
|
||||||
deleted file mode 100644
|
|
||||||
index 932055e8..00000000
|
|
||||||
--- a/.eslintrc
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,248 +0,0 @@
|
|
||||||
-{
|
|
||||||
- "root": true,
|
|
||||||
- "plugins": [
|
|
||||||
- "eslint-plugin",
|
|
||||||
- "import",
|
|
||||||
- ],
|
|
||||||
- "extends": [
|
|
||||||
- "eslint:recommended",
|
|
||||||
- "plugin:eslint-plugin/recommended",
|
|
||||||
- "plugin:import/recommended",
|
|
||||||
- ],
|
|
||||||
- "env": {
|
|
||||||
- "node": true,
|
|
||||||
- "es6": true,
|
|
||||||
- "es2017": true,
|
|
||||||
- },
|
|
||||||
- "parserOptions": {
|
|
||||||
- "sourceType": "module",
|
|
||||||
- "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 }],
|
|
||||||
- "block-spacing": [2, "always"],
|
|
||||||
- "brace-style": [2, "1tbs", { "allowSingleLine": true }],
|
|
||||||
- "comma-dangle": ["error", {
|
|
||||||
- "arrays": "always-multiline",
|
|
||||||
- "objects": "always-multiline",
|
|
||||||
- "imports": "always-multiline",
|
|
||||||
- "exports": "always-multiline",
|
|
||||||
- "functions": "always-multiline",
|
|
||||||
- }],
|
|
||||||
- "comma-spacing": [2, { "before": false, "after": true }],
|
|
||||||
- "comma-style": [2, "last"],
|
|
||||||
- "computed-property-spacing": [2, "never"],
|
|
||||||
- "curly": [2, "all"],
|
|
||||||
- "default-case": [2, { "commentPattern": "(?:)" }],
|
|
||||||
- "default-case-last": [2],
|
|
||||||
- "default-param-last": [2],
|
|
||||||
- "dot-location": [2, "property"],
|
|
||||||
- "dot-notation": [2, { "allowKeywords": true, "allowPattern": "throws" }],
|
|
||||||
- "eol-last": [2, "always"],
|
|
||||||
- "eqeqeq": [2, "allow-null"],
|
|
||||||
- "for-direction": [2],
|
|
||||||
- "function-call-argument-newline": [2, "consistent"],
|
|
||||||
- "func-call-spacing": [2, "never"],
|
|
||||||
- "implicit-arrow-linebreak": [2, "beside"],
|
|
||||||
- "indent": [2, 2, {
|
|
||||||
- "SwitchCase": 1,
|
|
||||||
- "VariableDeclarator": 1,
|
|
||||||
- "outerIIFEBody": 1,
|
|
||||||
- "FunctionDeclaration": {
|
|
||||||
- "parameters": 1,
|
|
||||||
- "body": 1
|
|
||||||
- },
|
|
||||||
- "FunctionExpression": {
|
|
||||||
- "parameters": 1,
|
|
||||||
- "body": 1
|
|
||||||
- },
|
|
||||||
- "CallExpression": {
|
|
||||||
- "arguments": 1
|
|
||||||
- },
|
|
||||||
- "ArrayExpression": 1,
|
|
||||||
- "ObjectExpression": 1,
|
|
||||||
- "ImportDeclaration": 1,
|
|
||||||
- "flatTernaryExpressions": false,
|
|
||||||
- }],
|
|
||||||
- "jsx-quotes": [2, "prefer-double"],
|
|
||||||
- "key-spacing": [2, {
|
|
||||||
- "beforeColon": false,
|
|
||||||
- "afterColon": true,
|
|
||||||
- "mode": "strict",
|
|
||||||
- }],
|
|
||||||
- "keyword-spacing": ["error", {
|
|
||||||
- "before": true,
|
|
||||||
- "after": true,
|
|
||||||
- "overrides": {
|
|
||||||
- "return": { "after": true },
|
|
||||||
- "throw": { "after": true },
|
|
||||||
- "case": { "after": true }
|
|
||||||
- }
|
|
||||||
- }],
|
|
||||||
- "linebreak-style": [2, "unix"],
|
|
||||||
- "lines-around-directive": [2, {
|
|
||||||
- "before": "always",
|
|
||||||
- "after": "always",
|
|
||||||
- }],
|
|
||||||
- "max-len": 0,
|
|
||||||
- "new-parens": 2,
|
|
||||||
- "no-array-constructor": 2,
|
|
||||||
- "no-compare-neg-zero": 2,
|
|
||||||
- "no-cond-assign": [2, "always"],
|
|
||||||
- "no-extra-parens": 2,
|
|
||||||
- "no-multiple-empty-lines": [2, { "max": 1, "maxEOF": 1, "maxBOF": 0 }],
|
|
||||||
- "no-return-assign": [2, "always"],
|
|
||||||
- "no-trailing-spaces": 2,
|
|
||||||
- "no-var": 2,
|
|
||||||
- "object-curly-spacing": [2, "always"],
|
|
||||||
- "object-shorthand": ["error", "always", {
|
|
||||||
- "ignoreConstructors": false,
|
|
||||||
- "avoidQuotes": false,
|
|
||||||
- "avoidExplicitReturnArrows": true,
|
|
||||||
- }],
|
|
||||||
- "one-var": [2, "never"],
|
|
||||||
- "operator-linebreak": [2, "none", {
|
|
||||||
- "overrides": {
|
|
||||||
- "?": "before",
|
|
||||||
- ":": "before",
|
|
||||||
- "&&": "before",
|
|
||||||
- "||": "before",
|
|
||||||
- },
|
|
||||||
- }],
|
|
||||||
- "prefer-const": 2,
|
|
||||||
- "prefer-object-spread": 2,
|
|
||||||
- "prefer-rest-params": 2,
|
|
||||||
- "prefer-template": 2,
|
|
||||||
- "quote-props": [2, "as-needed", { "keywords": false }],
|
|
||||||
- "quotes": [2, "single", {
|
|
||||||
- "allowTemplateLiterals": true,
|
|
||||||
- "avoidEscape": true,
|
|
||||||
- }],
|
|
||||||
- "rest-spread-spacing": [2, "never"],
|
|
||||||
- "semi": [2, "always"],
|
|
||||||
- "semi-spacing": [2, { "before": false, "after": true }],
|
|
||||||
- "semi-style": [2, "last"],
|
|
||||||
- "space-before-blocks": [2, { "functions": "always", "keywords": "always", "classes": "always" }],
|
|
||||||
- "space-before-function-paren": ["error", {
|
|
||||||
- "anonymous": "always",
|
|
||||||
- "named": "never",
|
|
||||||
- "asyncArrow": "always",
|
|
||||||
- }],
|
|
||||||
- "space-in-parens": [2, "never"],
|
|
||||||
- "space-infix-ops": [2],
|
|
||||||
- "space-unary-ops": [2, { "words": true, "nonwords": false }],
|
|
||||||
- "switch-colon-spacing": [2, { "after": true, "before": false }],
|
|
||||||
- "template-curly-spacing": [2, "never"],
|
|
||||||
- "template-tag-spacing": [2, "never"],
|
|
||||||
- "unicode-bom": [2, "never"],
|
|
||||||
- "use-isnan": [2, { "enforceForSwitchCase": true }],
|
|
||||||
- "valid-typeof": [2],
|
|
||||||
- "wrap-iife": [2, "outside", { "functionPrototypeMethods": true }],
|
|
||||||
- "wrap-regex": [2],
|
|
||||||
- "yield-star-spacing": [2, { "before": false, "after": true }],
|
|
||||||
- "yoda": [2, "never", { "exceptRange": true, "onlyEquality": false }],
|
|
||||||
-
|
|
||||||
- "eslint-plugin/consistent-output": [
|
|
||||||
- "error",
|
|
||||||
- "always",
|
|
||||||
- ],
|
|
||||||
- "eslint-plugin/meta-property-ordering": "error",
|
|
||||||
- "eslint-plugin/no-deprecated-context-methods": "error",
|
|
||||||
- "eslint-plugin/no-deprecated-report-api": "off",
|
|
||||||
- "eslint-plugin/prefer-replace-text": "error",
|
|
||||||
- "eslint-plugin/report-message-format": "error",
|
|
||||||
- "eslint-plugin/require-meta-docs-description": ["error", { "pattern": "^(Enforce|Ensure|Prefer|Forbid).+\\.$" }],
|
|
||||||
- "eslint-plugin/require-meta-schema": "error",
|
|
||||||
- "eslint-plugin/require-meta-type": "error",
|
|
||||||
-
|
|
||||||
- // dog fooding
|
|
||||||
- "import/no-extraneous-dependencies": ["error", {
|
|
||||||
- "devDependencies": [
|
|
||||||
- "tests/**",
|
|
||||||
- "resolvers/*/test/**",
|
|
||||||
- "scripts/**"
|
|
||||||
- ],
|
|
||||||
- "optionalDependencies": false,
|
|
||||||
- "peerDependencies": true,
|
|
||||||
- "bundledDependencies": false,
|
|
||||||
- }],
|
|
||||||
- "import/unambiguous": "off",
|
|
||||||
- },
|
|
||||||
-
|
|
||||||
- "settings": {
|
|
||||||
- "import/resolver": {
|
|
||||||
- "node": {
|
|
||||||
- "paths": [
|
|
||||||
- "src",
|
|
||||||
- ],
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
-
|
|
||||||
- "overrides": [
|
|
||||||
- {
|
|
||||||
- "files": "scripts/**",
|
|
||||||
- "rules": {
|
|
||||||
- "no-console": "off",
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- "files": "resolvers/**",
|
|
||||||
- "env": {
|
|
||||||
- "es6": false,
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- "files": "resolvers/webpack/**",
|
|
||||||
- "rules": {
|
|
||||||
- "no-console": 1,
|
|
||||||
- "prefer-template": 0,
|
|
||||||
- "prefer-object-spread": 0,
|
|
||||||
- "prefer-rest-params": 0,
|
|
||||||
- },
|
|
||||||
- "env": {
|
|
||||||
- "es6": true,
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- "files": [
|
|
||||||
- "resolvers/*/test/**/*",
|
|
||||||
- ],
|
|
||||||
- "env": {
|
|
||||||
- "mocha": true,
|
|
||||||
- "es6": false
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- "files": "utils/**",
|
|
||||||
- "parserOptions": {
|
|
||||||
- "ecmaVersion": 6,
|
|
||||||
- },
|
|
||||||
- "rules": {
|
|
||||||
- "comma-dangle": ["error", {
|
|
||||||
- "arrays": "always-multiline",
|
|
||||||
- "objects": "always-multiline",
|
|
||||||
- "imports": "always-multiline",
|
|
||||||
- "exports": "always-multiline",
|
|
||||||
- "functions": "never"
|
|
||||||
- }],
|
|
||||||
- "prefer-object-spread": "off",
|
|
||||||
- "prefer-template": "off",
|
|
||||||
- "no-console": 1,
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- "files": "tests/**",
|
|
||||||
- "env": {
|
|
||||||
- "mocha": true,
|
|
||||||
- },
|
|
||||||
- "rules": {
|
|
||||||
- "max-len": 0,
|
|
||||||
- "import/default": 0,
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- ],
|
|
||||||
-}
|
|
||||||
diff --git a/config/electron.js b/config/electron.js
|
|
||||||
index f98ff061..0f3aa51d 100644
|
|
||||||
--- a/config/electron.js
|
|
||||||
+++ b/config/electron.js
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
/**
|
|
||||||
* Default settings for Electron applications.
|
|
||||||
*/
|
|
||||||
-module.exports = {
|
|
||||||
+export default {
|
|
||||||
settings: {
|
|
||||||
'import/core-modules': ['electron'],
|
|
||||||
},
|
|
||||||
diff --git a/config/errors.js b/config/errors.js
|
|
||||||
index 127c29a0..b46a4c0b 100644
|
|
||||||
--- a/config/errors.js
|
|
||||||
+++ b/config/errors.js
|
|
||||||
@@ -1,9 +1,8 @@
|
|
||||||
/**
|
|
||||||
* unopinionated config. just the things that are necessarily runtime errors
|
|
||||||
* waiting to happen.
|
|
||||||
- * @type {Object}
|
|
||||||
*/
|
|
||||||
-module.exports = {
|
|
||||||
+export default {
|
|
||||||
plugins: ['import'],
|
|
||||||
rules: { 'import/no-unresolved': 2,
|
|
||||||
'import/named': 2,
|
|
||||||
diff --git a/config/react-native.js b/config/react-native.js
|
|
||||||
index a1aa0ee5..97bdf0cf 100644
|
|
||||||
--- a/config/react-native.js
|
|
||||||
+++ b/config/react-native.js
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
/**
|
|
||||||
* - adds platform extensions to Node resolver
|
|
||||||
*/
|
|
||||||
-module.exports = {
|
|
||||||
+export default {
|
|
||||||
settings: {
|
|
||||||
'import/resolver': {
|
|
||||||
node: {
|
|
||||||
diff --git a/config/react.js b/config/react.js
|
|
||||||
index 68555512..8e090a83 100644
|
|
||||||
--- a/config/react.js
|
|
||||||
+++ b/config/react.js
|
|
||||||
@@ -5,7 +5,7 @@
|
|
||||||
* define jsnext:main and have JSX internally, you may run into problems
|
|
||||||
* if you don't enable these settings at the top level.
|
|
||||||
*/
|
|
||||||
-module.exports = {
|
|
||||||
+export default {
|
|
||||||
|
|
||||||
settings: {
|
|
||||||
'import/extensions': ['.js', '.jsx'],
|
|
||||||
diff --git a/config/recommended.js b/config/recommended.js
|
|
||||||
index 8e7ca9fd..9ced8146 100644
|
|
||||||
--- a/config/recommended.js
|
|
||||||
+++ b/config/recommended.js
|
|
||||||
@@ -1,8 +1,7 @@
|
|
||||||
/**
|
|
||||||
* The basics.
|
|
||||||
- * @type {Object}
|
|
||||||
*/
|
|
||||||
-module.exports = {
|
|
||||||
+export default {
|
|
||||||
plugins: ['import'],
|
|
||||||
|
|
||||||
rules: {
|
|
||||||
diff --git a/config/stage-0.js b/config/stage-0.js
|
|
||||||
index 42419123..01ebeeb8 100644
|
|
||||||
--- a/config/stage-0.js
|
|
||||||
+++ b/config/stage-0.js
|
|
||||||
@@ -2,9 +2,8 @@
|
|
||||||
* Rules in progress.
|
|
||||||
*
|
|
||||||
* Do not expect these to adhere to semver across releases.
|
|
||||||
- * @type {Object}
|
|
||||||
*/
|
|
||||||
-module.exports = {
|
|
||||||
+export default {
|
|
||||||
plugins: ['import'],
|
|
||||||
rules: {
|
|
||||||
'import/no-deprecated': 1,
|
|
||||||
diff --git a/config/typescript.js b/config/typescript.js
|
|
||||||
index 9fd789db..c277b6c5 100644
|
|
||||||
--- a/config/typescript.js
|
|
||||||
+++ b/config/typescript.js
|
|
||||||
@@ -7,7 +7,7 @@
|
|
||||||
// `.ts`/`.tsx`/`.js`/`.jsx` implementation.
|
|
||||||
const allExtensions = ['.ts', '.tsx', '.js', '.jsx'];
|
|
||||||
|
|
||||||
-module.exports = {
|
|
||||||
+export default {
|
|
||||||
|
|
||||||
settings: {
|
|
||||||
'import/extensions': allExtensions,
|
|
||||||
diff --git a/config/warnings.js b/config/warnings.js
|
|
||||||
index 5d74143b..ffa27d8d 100644
|
|
||||||
--- a/config/warnings.js
|
|
||||||
+++ b/config/warnings.js
|
|
||||||
@@ -1,8 +1,7 @@
|
|
||||||
/**
|
|
||||||
* more opinionated config.
|
|
||||||
- * @type {Object}
|
|
||||||
*/
|
|
||||||
-module.exports = {
|
|
||||||
+export default {
|
|
||||||
plugins: ['import'],
|
|
||||||
rules: {
|
|
||||||
'import/no-named-as-default': 1,
|
|
||||||
diff --git a/scripts/resolverDirectories.js b/scripts/resolverDirectories.js
|
|
||||||
index f0c03a3c..a7cadb55 100644
|
|
||||||
--- a/scripts/resolverDirectories.js
|
|
||||||
+++ b/scripts/resolverDirectories.js
|
|
||||||
@@ -1,3 +1,3 @@
|
|
||||||
-import glob from 'glob';
|
|
||||||
+import { globSync } from 'glob';
|
|
||||||
|
|
||||||
-export default glob.sync('./resolvers/*/');
|
|
||||||
+export default globSync('./resolvers/*/');
|
|
||||||
diff --git a/src/docsUrl.js b/src/docsUrl.js
|
|
||||||
index 92b838c0..ccb13ba0 100644
|
|
||||||
--- a/src/docsUrl.js
|
|
||||||
+++ b/src/docsUrl.js
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
-import pkg from '../package.json';
|
|
||||||
+import { version } from '../package.json';
|
|
||||||
|
|
||||||
const repoUrl = 'https://github.com/import-js/eslint-plugin-import';
|
|
||||||
|
|
||||||
-export default function docsUrl(ruleName, commitish = `v${pkg.version}`) {
|
|
||||||
+export default function docsUrl(ruleName, commitish = `v${version}`) {
|
|
||||||
return `${repoUrl}/blob/${commitish}/docs/rules/${ruleName}.md`;
|
|
||||||
}
|
|
||||||
diff --git a/src/index.js b/src/index.js
|
|
||||||
index feafba90..9a464041 100644
|
|
||||||
--- a/src/index.js
|
|
||||||
+++ b/src/index.js
|
|
||||||
@@ -1,71 +1,135 @@
|
|
||||||
-export const rules = {
|
|
||||||
- 'no-unresolved': require('./rules/no-unresolved'),
|
|
||||||
- named: require('./rules/named'),
|
|
||||||
- default: require('./rules/default'),
|
|
||||||
- namespace: require('./rules/namespace'),
|
|
||||||
- 'no-namespace': require('./rules/no-namespace'),
|
|
||||||
- export: require('./rules/export'),
|
|
||||||
- 'no-mutable-exports': require('./rules/no-mutable-exports'),
|
|
||||||
- extensions: require('./rules/extensions'),
|
|
||||||
- 'no-restricted-paths': require('./rules/no-restricted-paths'),
|
|
||||||
- 'no-internal-modules': require('./rules/no-internal-modules'),
|
|
||||||
- 'group-exports': require('./rules/group-exports'),
|
|
||||||
- 'no-relative-packages': require('./rules/no-relative-packages'),
|
|
||||||
- 'no-relative-parent-imports': require('./rules/no-relative-parent-imports'),
|
|
||||||
- 'consistent-type-specifier-style': require('./rules/consistent-type-specifier-style'),
|
|
||||||
+/* eslint-disable spaced-comment */
|
|
||||||
+import noUnresolved from './rules/no-unresolved';
|
|
||||||
+import named from './rules/named';
|
|
||||||
+import defaultRule from './rules/default';
|
|
||||||
+import namespace from './rules/namespace';
|
|
||||||
+import noNamespace from './rules/no-namespace';
|
|
||||||
+import exportRule from './rules/export';
|
|
||||||
+import noMutableExports from './rules/no-mutable-exports';
|
|
||||||
+import extensions from './rules/extensions';
|
|
||||||
+import noRestrictedPaths from './rules/no-restricted-paths';
|
|
||||||
+import noInternalModules from './rules/no-internal-modules';
|
|
||||||
+import groupExports from './rules/group-exports';
|
|
||||||
+import noRelativePackages from './rules/no-relative-packages';
|
|
||||||
+import noRelativeParentImports from './rules/no-relative-parent-imports';
|
|
||||||
+import consistentTypeSpecifierStyle from './rules/consistent-type-specifier-style';
|
|
||||||
+import noSelfImport from './rules/no-self-import';
|
|
||||||
+import noCycle from './rules/no-cycle';
|
|
||||||
+import noNamedDefault from './rules/no-named-default';
|
|
||||||
+import noNamedAsDefault from './rules/no-named-as-default';
|
|
||||||
+import noNamedAsDefaultMember from './rules/no-named-as-default-member';
|
|
||||||
+import noAnonymousDefaultExport from './rules/no-anonymous-default-export';
|
|
||||||
+import noUnusedModules from './rules/no-unused-modules';
|
|
||||||
+import noCommonjs from './rules/no-commonjs';
|
|
||||||
+import noAmd from './rules/no-amd';
|
|
||||||
+import noDuplicates from './rules/no-duplicates';
|
|
||||||
+import first from './rules/first';
|
|
||||||
+import maxDependencies from './rules/max-dependencies';
|
|
||||||
+import noExtraneousDependencies from './rules/no-extraneous-dependencies';
|
|
||||||
+import noAbsolutePath from './rules/no-absolute-path';
|
|
||||||
+import noNodejsModules from './rules/no-nodejs-modules';
|
|
||||||
+import noWebpackLoaderSyntax from './rules/no-webpack-loader-syntax';
|
|
||||||
+import order from './rules/order';
|
|
||||||
+import newlineAfterImport from './rules/newline-after-import';
|
|
||||||
+import preferDefaultExport from './rules/prefer-default-export';
|
|
||||||
+import noDefaultExport from './rules/no-default-export';
|
|
||||||
+import noNamedExport from './rules/no-named-export';
|
|
||||||
+import noDynamicRequire from './rules/no-dynamic-require';
|
|
||||||
+import unambiguous from './rules/unambiguous';
|
|
||||||
+import noUnassignedImport from './rules/no-unassigned-import';
|
|
||||||
+import noUselessPathSegments from './rules/no-useless-path-segments';
|
|
||||||
+import dynamicImportChunkname from './rules/dynamic-import-chunkname';
|
|
||||||
+import noImportModuleExports from './rules/no-import-module-exports';
|
|
||||||
+import noEmptyNamedBlocks from './rules/no-empty-named-blocks';
|
|
||||||
+import exportsLast from './rules/exports-last';
|
|
||||||
+import noDeprecated from './rules/no-deprecated';
|
|
||||||
+import importsFirst from './rules/imports-first';
|
|
||||||
+import recommended from '../config/recommended';
|
|
||||||
+import errors from '../config/errors';
|
|
||||||
+import warnings from '../config/warnings';
|
|
||||||
+import stage0 from '../config/stage-0';
|
|
||||||
+import react from '../config/react';
|
|
||||||
+import reactNative from '../config/react-native';
|
|
||||||
+import electron from '../config/electron';
|
|
||||||
+import typescript from '../config/typescript';
|
|
||||||
|
|
||||||
- 'no-self-import': require('./rules/no-self-import'),
|
|
||||||
- 'no-cycle': require('./rules/no-cycle'),
|
|
||||||
- 'no-named-default': require('./rules/no-named-default'),
|
|
||||||
- 'no-named-as-default': require('./rules/no-named-as-default'),
|
|
||||||
- 'no-named-as-default-member': require('./rules/no-named-as-default-member'),
|
|
||||||
- 'no-anonymous-default-export': require('./rules/no-anonymous-default-export'),
|
|
||||||
- 'no-unused-modules': require('./rules/no-unused-modules'),
|
|
||||||
+/**
|
|
||||||
+ * @type {Readonly<import('eslint').Linter.RulesRecord>}
|
|
||||||
+ */
|
|
||||||
+export const rules = /*#__PURE__*/ kebabCase({
|
|
||||||
+ noUnresolved,
|
|
||||||
+ named,
|
|
||||||
+ default: defaultRule,
|
|
||||||
+ namespace,
|
|
||||||
+ noNamespace,
|
|
||||||
+ export: exportRule,
|
|
||||||
+ noMutableExports,
|
|
||||||
+ extensions,
|
|
||||||
+ noRestrictedPaths,
|
|
||||||
+ noInternalModules,
|
|
||||||
+ groupExports,
|
|
||||||
+ noRelativePackages,
|
|
||||||
+ noRelativeParentImports,
|
|
||||||
+ consistentTypeSpecifierStyle,
|
|
||||||
|
|
||||||
- 'no-commonjs': require('./rules/no-commonjs'),
|
|
||||||
- 'no-amd': require('./rules/no-amd'),
|
|
||||||
- 'no-duplicates': require('./rules/no-duplicates'),
|
|
||||||
- first: require('./rules/first'),
|
|
||||||
- 'max-dependencies': require('./rules/max-dependencies'),
|
|
||||||
- 'no-extraneous-dependencies': require('./rules/no-extraneous-dependencies'),
|
|
||||||
- 'no-absolute-path': require('./rules/no-absolute-path'),
|
|
||||||
- 'no-nodejs-modules': require('./rules/no-nodejs-modules'),
|
|
||||||
- 'no-webpack-loader-syntax': require('./rules/no-webpack-loader-syntax'),
|
|
||||||
- order: require('./rules/order'),
|
|
||||||
- 'newline-after-import': require('./rules/newline-after-import'),
|
|
||||||
- 'prefer-default-export': require('./rules/prefer-default-export'),
|
|
||||||
- 'no-default-export': require('./rules/no-default-export'),
|
|
||||||
- 'no-named-export': require('./rules/no-named-export'),
|
|
||||||
- 'no-dynamic-require': require('./rules/no-dynamic-require'),
|
|
||||||
- unambiguous: require('./rules/unambiguous'),
|
|
||||||
- 'no-unassigned-import': require('./rules/no-unassigned-import'),
|
|
||||||
- 'no-useless-path-segments': require('./rules/no-useless-path-segments'),
|
|
||||||
- 'dynamic-import-chunkname': require('./rules/dynamic-import-chunkname'),
|
|
||||||
- 'no-import-module-exports': require('./rules/no-import-module-exports'),
|
|
||||||
- 'no-empty-named-blocks': require('./rules/no-empty-named-blocks'),
|
|
||||||
+ noSelfImport,
|
|
||||||
+ noCycle,
|
|
||||||
+ noNamedDefault,
|
|
||||||
+ noNamedAsDefault,
|
|
||||||
+ noNamedAsDefaultMember,
|
|
||||||
+ noAnonymousDefaultExport,
|
|
||||||
+ noUnusedModules,
|
|
||||||
+
|
|
||||||
+ noCommonjs,
|
|
||||||
+ noAmd,
|
|
||||||
+ noDuplicates,
|
|
||||||
+ first,
|
|
||||||
+ maxDependencies,
|
|
||||||
+ noExtraneousDependencies,
|
|
||||||
+ noAbsolutePath,
|
|
||||||
+ noNodejsModules,
|
|
||||||
+ noWebpackLoaderSyntax,
|
|
||||||
+ order,
|
|
||||||
+ newlineAfterImport,
|
|
||||||
+ preferDefaultExport,
|
|
||||||
+ noDefaultExport,
|
|
||||||
+ noNamedExport,
|
|
||||||
+ noDynamicRequire,
|
|
||||||
+ unambiguous,
|
|
||||||
+ noUnassignedImport,
|
|
||||||
+ noUselessPathSegments,
|
|
||||||
+ dynamicImportChunkname,
|
|
||||||
+ noImportModuleExports,
|
|
||||||
+ noEmptyNamedBlocks,
|
|
||||||
|
|
||||||
// export
|
|
||||||
- 'exports-last': require('./rules/exports-last'),
|
|
||||||
+ exportsLast,
|
|
||||||
|
|
||||||
// metadata-based
|
|
||||||
- 'no-deprecated': require('./rules/no-deprecated'),
|
|
||||||
+ noDeprecated,
|
|
||||||
|
|
||||||
// deprecated aliases to rules
|
|
||||||
- 'imports-first': require('./rules/imports-first'),
|
|
||||||
-};
|
|
||||||
+ importsFirst,
|
|
||||||
+});
|
|
||||||
|
|
||||||
export const configs = {
|
|
||||||
- recommended: require('../config/recommended'),
|
|
||||||
+ recommended,
|
|
||||||
|
|
||||||
- errors: require('../config/errors'),
|
|
||||||
- warnings: require('../config/warnings'),
|
|
||||||
+ errors,
|
|
||||||
+ warnings,
|
|
||||||
|
|
||||||
// shhhh... work in progress "secret" rules
|
|
||||||
- 'stage-0': require('../config/stage-0'),
|
|
||||||
+ 'stage-0': stage0,
|
|
||||||
|
|
||||||
// useful stuff for folks using various environments
|
|
||||||
- react: require('../config/react'),
|
|
||||||
- 'react-native': require('../config/react-native'),
|
|
||||||
- electron: require('../config/electron'),
|
|
||||||
- typescript: require('../config/typescript'),
|
|
||||||
+ react,
|
|
||||||
+ 'react-native': reactNative,
|
|
||||||
+ electron,
|
|
||||||
+ typescript,
|
|
||||||
};
|
|
||||||
+
|
|
||||||
+function kebabCase(obj) {
|
|
||||||
+ return Object.fromEntries(
|
|
||||||
+ Object.entries(obj).map(([key, value]) => [key.replace(/([A-Z])/g, '-$1').toLowerCase(), value])
|
|
||||||
+ )
|
|
||||||
+}
|
|
||||||
\ 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,
|
|
@ -616,3 +616,16 @@ index 7b931fe..eaea267 100644
|
|||||||
+ ]),
|
+ ]),
|
||||||
+ );
|
+ );
|
||||||
+}
|
+}
|
||||||
|
diff --git a/src/util/mayContainChildComponent.js b/src/util/mayContainChildComponent.js
|
||||||
|
index 43a03ef..5e1035e 100644
|
||||||
|
--- a/src/util/mayContainChildComponent.js
|
||||||
|
+++ b/src/util/mayContainChildComponent.js
|
||||||
|
@@ -9,7 +9,7 @@
|
||||||
|
|
||||||
|
import type { JSXOpeningElement, Node } from 'ast-types-flow';
|
||||||
|
import { elementType as rawElementType } from 'jsx-ast-utils';
|
||||||
|
-import minimatch from 'minimatch';
|
||||||
|
+import { minimatch } from 'minimatch';
|
||||||
|
|
||||||
|
export default function mayContainChildComponent(
|
||||||
|
root: Node,
|
||||||
|
1125
pnpm-lock.yaml
generated
1125
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user