Remove import
This commit is contained in:
parent
c175f87441
commit
674eaf1811
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
drafts
|
||||
!/packages/eslint-plugin-react-hooks
|
||||
/packages/eslint-define-config
|
||||
/react
|
||||
src/types/rules
|
||||
|
||||
|
14
dist/eslint-plugin-import/index.d.ts
vendored
14
dist/eslint-plugin-import/index.d.ts
vendored
@ -1,14 +0,0 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
export const rules: Readonly<Linter.RulesRecord>;
|
||||
|
||||
export const configs: {
|
||||
recommended: Linter.BaseConfig;
|
||||
errors: Linter.BaseConfig;
|
||||
warnings: Linter.BaseConfig;
|
||||
'stage-0': Linter.BaseConfig;
|
||||
react: Linter.BaseConfig;
|
||||
'react-native': Linter.BaseConfig;
|
||||
electron: Linter.BaseConfig;
|
||||
typescript: Linter.BaseConfig;
|
||||
};
|
4
dist/index.d.ts
vendored
4
dist/index.d.ts
vendored
@ -1,8 +1,8 @@
|
||||
// Generated by dts-bundle-generator v9.4.0
|
||||
|
||||
import { ESLintConfig, Rules } from '@aet/eslint-define-config';
|
||||
import { ESLintUtils } from '@typescript-eslint/utils';
|
||||
import { Rule } from 'eslint';
|
||||
import { ESLintConfig, Rules } from 'eslint-define-config';
|
||||
|
||||
export declare const error = "error";
|
||||
export declare const warn = "warn";
|
||||
@ -41,7 +41,7 @@ export type InputConfig = Omit<ESLintConfig, "rules"> & {
|
||||
* Rules.
|
||||
* @see [Rules](https://eslint.org/docs/latest/user-guide/configuring/rules)
|
||||
*/
|
||||
rules?: RuleOptions;
|
||||
rules?: Partial<RuleOptions>;
|
||||
/**
|
||||
* Glob pattern to find paths to custom rule files in JavaScript or TypeScript.
|
||||
* Note this must be a string literal or an array of string literals since
|
||||
|
27
dist/package.json
vendored
27
dist/package.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aet/eslint-rules",
|
||||
"version": "0.0.26",
|
||||
"version": "0.0.27",
|
||||
"license": "UNLICENSED",
|
||||
"peerDependencies": {
|
||||
"eslint": "^8.57.0",
|
||||
@ -9,30 +9,31 @@
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@types/eslint": "^8.56.10",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"@typescript-eslint/type-utils": "^7.8.0",
|
||||
"@typescript-eslint/utils": "^7.8.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.13.0",
|
||||
"@typescript-eslint/parser": "^7.13.0",
|
||||
"@typescript-eslint/type-utils": "^7.13.0",
|
||||
"@typescript-eslint/utils": "^7.13.0",
|
||||
"aria-query": "^5.3.0",
|
||||
"axe-core": "^4.9.0",
|
||||
"axe-core": "^4.9.1",
|
||||
"axobject-query": "^4.0.0",
|
||||
"damerau-levenshtein": "1.0.8",
|
||||
"debug": "^4.3.4",
|
||||
"debug": "^4.3.5",
|
||||
"doctrine": "^3.0.0",
|
||||
"emoji-regex": "^10.3.0",
|
||||
"enhanced-resolve": "^5.16.0",
|
||||
"enhanced-resolve": "^5.17.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-define-config": "^1.24.1",
|
||||
"eslint-import-resolver-node": "^0.3.9",
|
||||
"eslint-module-utils": "^2.8.1",
|
||||
"eslint-plugin-es-x": "^7.6.0",
|
||||
"eslint-plugin-jsdoc": "^48.2.3",
|
||||
"eslint-plugin-unicorn": "^52.0.0",
|
||||
"eslint-plugin-es-x": "^7.7.0",
|
||||
"eslint-plugin-import-x": "^0.5.1",
|
||||
"eslint-plugin-jsdoc": "^48.2.12",
|
||||
"eslint-plugin-unicorn": "^54.0.0",
|
||||
"esprima": "^4.0.1",
|
||||
"esquery": "^1.5.0",
|
||||
"estraverse": "^5.3.0",
|
||||
"fast-glob": "^3.3.2",
|
||||
"get-tsconfig": "^4.7.3",
|
||||
"get-tsconfig": "^4.7.5",
|
||||
"ignore": "^5.3.1",
|
||||
"is-builtin-module": "^4.0.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@ -40,7 +41,7 @@
|
||||
"lodash": "^4.17.21",
|
||||
"minimatch": "^9.0.4",
|
||||
"resolve": "^2.0.0-next.5",
|
||||
"semver": "^7.6.0",
|
||||
"semver": "^7.6.2",
|
||||
"tsconfig-paths": "^4.2.0"
|
||||
},
|
||||
"overrides": {
|
||||
|
31
package.json
31
package.json
@ -6,31 +6,32 @@
|
||||
},
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.24.5",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.24.1",
|
||||
"@babel/preset-env": "^7.24.5",
|
||||
"@aet/eslint-define-config": "0.1.0-beta.1",
|
||||
"@babel/core": "^7.24.7",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.24.7",
|
||||
"@babel/preset-env": "^7.24.7",
|
||||
"@types/babel-plugin-macros": "^3.1.3",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"@types/eslint": "^8.56.10",
|
||||
"@types/esprima": "^4.0.6",
|
||||
"@types/esquery": "^1.5.3",
|
||||
"@types/esquery": "^1.5.4",
|
||||
"@types/estree": "^1.0.5",
|
||||
"@types/estree-jsx": "^1.0.5",
|
||||
"@types/lodash": "^4.17.1",
|
||||
"@types/node": "^20.12.8",
|
||||
"@typescript-eslint/eslint-plugin": "7.8.0",
|
||||
"@typescript-eslint/type-utils": "^7.8.0",
|
||||
"@typescript-eslint/types": "^7.8.0",
|
||||
"@typescript-eslint/typescript-estree": "^7.8.0",
|
||||
"@typescript-eslint/utils": "^7.8.0",
|
||||
"@types/lodash": "^4.17.5",
|
||||
"@types/node": "^20.14.2",
|
||||
"@typescript-eslint/eslint-plugin": "7.13.0",
|
||||
"@typescript-eslint/type-utils": "^7.13.0",
|
||||
"@typescript-eslint/types": "^7.13.0",
|
||||
"@typescript-eslint/typescript-estree": "^7.13.0",
|
||||
"@typescript-eslint/utils": "^7.13.0",
|
||||
"babel-plugin-macros": "^3.1.0",
|
||||
"dts-bundle-generator": "9.4.0",
|
||||
"esbin": "0.0.4",
|
||||
"esbuild": "0.20.2",
|
||||
"esbuild": "0.21.5",
|
||||
"esbuild-plugin-alias": "^0.2.1",
|
||||
"eslint": "8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-define-config": "^1.24.1",
|
||||
"eslint-plugin-import-x": "^0.5.1",
|
||||
"esprima": "^4.0.1",
|
||||
"esquery": "^1.5.0",
|
||||
"fast-glob": "^3.3.2",
|
||||
@ -39,8 +40,8 @@
|
||||
"lodash": "^4.17.21",
|
||||
"minimatch": "^9.0.4",
|
||||
"patch-package": "^8.0.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"prettier": "^3.2.5",
|
||||
"picocolors": "^1.0.1",
|
||||
"prettier": "^3.3.2",
|
||||
"prop-types": "^15.8.1",
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
|
@ -1,5 +1,5 @@
|
||||
diff --git a/package.json b/package.json
|
||||
index d00b065..fc63b32 100644
|
||||
index 8de1a68..a99b6f0 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -62,8 +62,7 @@
|
||||
@ -11,7 +11,7 @@ index d00b065..fc63b32 100644
|
||||
+ "eslint": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^4.3.4",
|
||||
"debug": "^4.3.5",
|
||||
diff --git a/tsconfig.json b/tsconfig.json
|
||||
deleted file mode 100644
|
||||
index a303861..0000000
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
||||
diff --git a/src/index.js b/src/index.js
|
||||
index 7b931fe..eaea267 100644
|
||||
index 752ff61..99a42a3 100644
|
||||
--- a/src/index.js
|
||||
+++ b/src/index.js
|
||||
@@ -1,296 +1,344 @@
|
||||
@@ -1,70 +1,110 @@
|
||||
/* eslint-disable global-require */
|
||||
+// @ts-check
|
||||
+import accessibleEmoji from './rules/accessible-emoji';
|
||||
@ -91,6 +91,11 @@ index 7b931fe..eaea267 100644
|
||||
- recommended: {
|
||||
- plugins: [
|
||||
- 'jsx-a11y',
|
||||
- ],
|
||||
- parserOptions: {
|
||||
- ecmaFeatures: {
|
||||
- jsx: true,
|
||||
- },
|
||||
+export const rules = kebabCase({
|
||||
+ accessibleEmoji,
|
||||
+ altText,
|
||||
@ -132,15 +137,27 @@ index 7b931fe..eaea267 100644
|
||||
+ scope,
|
||||
+ tabindexNoPositive,
|
||||
+});
|
||||
+
|
||||
+export const configs = {
|
||||
+ recommended: {
|
||||
+ plugins: [
|
||||
+ 'jsx-a11y',
|
||||
+ ],
|
||||
+ plugins: ['jsx-a11y'],
|
||||
+ parserOptions: {
|
||||
+ ecmaFeatures: {
|
||||
+ jsx: true,
|
||||
+ },
|
||||
},
|
||||
- rules: {
|
||||
- 'jsx-a11y/alt-text': 'error',
|
||||
- 'jsx-a11y/anchor-ambiguous-text': 'off', // TODO: error
|
||||
- 'jsx-a11y/anchor-has-content': 'error',
|
||||
- 'jsx-a11y/anchor-is-valid': 'error',
|
||||
- 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
||||
- 'jsx-a11y/aria-props': 'error',
|
||||
- 'jsx-a11y/aria-proptypes': 'error',
|
||||
- 'jsx-a11y/aria-role': 'error',
|
||||
- 'jsx-a11y/aria-unsupported-elements': 'error',
|
||||
- 'jsx-a11y/autocomplete-valid': 'error',
|
||||
- 'jsx-a11y/click-events-have-key-events': 'error',
|
||||
- 'jsx-a11y/control-has-associated-label': ['off', {
|
||||
+ },
|
||||
+ rules: {
|
||||
+ 'jsx-a11y/alt-text': 'error',
|
||||
@ -154,33 +171,22 @@ index 7b931fe..eaea267 100644
|
||||
+ 'jsx-a11y/aria-unsupported-elements': 'error',
|
||||
+ 'jsx-a11y/autocomplete-valid': 'error',
|
||||
+ 'jsx-a11y/click-events-have-key-events': 'error',
|
||||
+ 'jsx-a11y/control-has-associated-label': ['off', {
|
||||
+ ignoreElements: [
|
||||
+ 'audio',
|
||||
+ 'canvas',
|
||||
+ 'embed',
|
||||
+ 'input',
|
||||
+ 'textarea',
|
||||
+ 'tr',
|
||||
+ 'video',
|
||||
+ ],
|
||||
+ ignoreRoles: [
|
||||
+ 'grid',
|
||||
+ 'listbox',
|
||||
+ 'menu',
|
||||
+ 'menubar',
|
||||
+ 'radiogroup',
|
||||
+ 'row',
|
||||
+ 'tablist',
|
||||
+ 'toolbar',
|
||||
+ 'tree',
|
||||
+ 'treegrid',
|
||||
+ ],
|
||||
+ includeRoles: [
|
||||
+ 'alert',
|
||||
+ 'dialog',
|
||||
+ ],
|
||||
+ }],
|
||||
+ 'jsx-a11y/control-has-associated-label': [
|
||||
+ 'off',
|
||||
+ {
|
||||
ignoreElements: [
|
||||
'audio',
|
||||
'canvas',
|
||||
@@ -86,140 +126,122 @@ module.exports = {
|
||||
'tree',
|
||||
'treegrid',
|
||||
],
|
||||
- includeRoles: [
|
||||
- 'alert',
|
||||
- 'dialog',
|
||||
+ includeRoles: ['alert', 'dialog'],
|
||||
+ },
|
||||
+ ],
|
||||
+ 'jsx-a11y/heading-has-content': 'error',
|
||||
+ 'jsx-a11y/html-has-lang': 'error',
|
||||
+ 'jsx-a11y/iframe-has-title': 'error',
|
||||
@ -196,88 +202,7 @@ index 7b931fe..eaea267 100644
|
||||
+ 'spinbutton',
|
||||
+ 'switch',
|
||||
+ 'textbox',
|
||||
+ ],
|
||||
+ },
|
||||
],
|
||||
- parserOptions: {
|
||||
- ecmaFeatures: {
|
||||
- jsx: true,
|
||||
+ 'jsx-a11y/label-has-associated-control': 'error',
|
||||
+ 'jsx-a11y/label-has-for': 'off',
|
||||
+ 'jsx-a11y/media-has-caption': 'error',
|
||||
+ 'jsx-a11y/mouse-events-have-key-events': 'error',
|
||||
+ 'jsx-a11y/no-access-key': 'error',
|
||||
+ 'jsx-a11y/no-autofocus': 'error',
|
||||
+ 'jsx-a11y/no-distracting-elements': 'error',
|
||||
+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': [
|
||||
+ 'error',
|
||||
+ {
|
||||
+ tr: ['none', 'presentation'],
|
||||
+ canvas: ['img'],
|
||||
},
|
||||
- },
|
||||
- rules: {
|
||||
- 'jsx-a11y/alt-text': 'error',
|
||||
- 'jsx-a11y/anchor-ambiguous-text': 'off', // TODO: error
|
||||
- 'jsx-a11y/anchor-has-content': 'error',
|
||||
- 'jsx-a11y/anchor-is-valid': 'error',
|
||||
- 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
||||
- 'jsx-a11y/aria-props': 'error',
|
||||
- 'jsx-a11y/aria-proptypes': 'error',
|
||||
- 'jsx-a11y/aria-role': 'error',
|
||||
- 'jsx-a11y/aria-unsupported-elements': 'error',
|
||||
- 'jsx-a11y/autocomplete-valid': 'error',
|
||||
- 'jsx-a11y/click-events-have-key-events': 'error',
|
||||
- 'jsx-a11y/control-has-associated-label': ['off', {
|
||||
- ignoreElements: [
|
||||
- 'audio',
|
||||
- 'canvas',
|
||||
- 'embed',
|
||||
- 'input',
|
||||
- 'textarea',
|
||||
- 'tr',
|
||||
- 'video',
|
||||
+ ],
|
||||
+ 'jsx-a11y/no-noninteractive-element-interactions': [
|
||||
+ 'error',
|
||||
+ {
|
||||
+ handlers: [
|
||||
+ 'onClick',
|
||||
+ 'onError',
|
||||
+ 'onLoad',
|
||||
+ 'onMouseDown',
|
||||
+ 'onMouseUp',
|
||||
+ 'onKeyPress',
|
||||
+ 'onKeyDown',
|
||||
+ 'onKeyUp',
|
||||
],
|
||||
- ignoreRoles: [
|
||||
- 'grid',
|
||||
+ alert: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
|
||||
+ body: ['onError', 'onLoad'],
|
||||
+ dialog: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
|
||||
+ iframe: ['onError', 'onLoad'],
|
||||
+ img: ['onError', 'onLoad'],
|
||||
+ },
|
||||
+ ],
|
||||
+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': [
|
||||
+ 'error',
|
||||
+ {
|
||||
+ ul: [
|
||||
'listbox',
|
||||
'menu',
|
||||
'menubar',
|
||||
'radiogroup',
|
||||
- 'row',
|
||||
'tablist',
|
||||
- 'toolbar',
|
||||
'tree',
|
||||
'treegrid',
|
||||
],
|
||||
- includeRoles: [
|
||||
- 'alert',
|
||||
- 'dialog',
|
||||
- ],
|
||||
- }],
|
||||
- 'jsx-a11y/heading-has-content': 'error',
|
||||
- 'jsx-a11y/html-has-lang': 'error',
|
||||
@ -352,7 +277,7 @@ index 7b931fe..eaea267 100644
|
||||
- 'tree',
|
||||
- 'treegrid',
|
||||
- ],
|
||||
- li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
||||
- li: ['menuitem', 'menuitemradio', 'menuitemcheckbox', 'option', 'row', 'tab', 'treeitem'],
|
||||
- table: ['grid'],
|
||||
- td: ['gridcell'],
|
||||
- fieldset: ['radiogroup', 'presentation'],
|
||||
@ -390,49 +315,47 @@ index 7b931fe..eaea267 100644
|
||||
- strict: {
|
||||
- plugins: [
|
||||
- 'jsx-a11y',
|
||||
- ],
|
||||
- parserOptions: {
|
||||
- ecmaFeatures: {
|
||||
- jsx: true,
|
||||
- },
|
||||
- },
|
||||
- rules: {
|
||||
- 'jsx-a11y/alt-text': 'error',
|
||||
- 'jsx-a11y/anchor-has-content': 'error',
|
||||
- 'jsx-a11y/anchor-is-valid': 'error',
|
||||
- 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
||||
- 'jsx-a11y/aria-props': 'error',
|
||||
- 'jsx-a11y/aria-proptypes': 'error',
|
||||
- 'jsx-a11y/aria-role': 'error',
|
||||
- 'jsx-a11y/aria-unsupported-elements': 'error',
|
||||
- 'jsx-a11y/autocomplete-valid': 'error',
|
||||
- 'jsx-a11y/click-events-have-key-events': 'error',
|
||||
- 'jsx-a11y/control-has-associated-label': ['off', {
|
||||
- ignoreElements: [
|
||||
- 'audio',
|
||||
- 'canvas',
|
||||
- 'embed',
|
||||
- 'input',
|
||||
- 'textarea',
|
||||
- 'tr',
|
||||
- 'video',
|
||||
- ],
|
||||
- ignoreRoles: [
|
||||
- 'grid',
|
||||
+ ol: [
|
||||
'listbox',
|
||||
'menu',
|
||||
'menubar',
|
||||
'radiogroup',
|
||||
- 'row',
|
||||
'tablist',
|
||||
- 'toolbar',
|
||||
'tree',
|
||||
'treegrid',
|
||||
],
|
||||
- includeRoles: [
|
||||
- 'alert',
|
||||
- 'dialog',
|
||||
+ },
|
||||
+ ],
|
||||
+ 'jsx-a11y/label-has-associated-control': 'error',
|
||||
+ 'jsx-a11y/label-has-for': 'off',
|
||||
+ 'jsx-a11y/media-has-caption': 'error',
|
||||
+ 'jsx-a11y/mouse-events-have-key-events': 'error',
|
||||
+ 'jsx-a11y/no-access-key': 'error',
|
||||
+ 'jsx-a11y/no-autofocus': 'error',
|
||||
+ 'jsx-a11y/no-distracting-elements': 'error',
|
||||
+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': [
|
||||
+ 'error',
|
||||
+ {
|
||||
+ tr: ['none', 'presentation'],
|
||||
+ canvas: ['img'],
|
||||
+ },
|
||||
+ ],
|
||||
+ 'jsx-a11y/no-noninteractive-element-interactions': [
|
||||
+ 'error',
|
||||
+ {
|
||||
+ handlers: [
|
||||
+ 'onClick',
|
||||
+ 'onError',
|
||||
+ 'onLoad',
|
||||
+ 'onMouseDown',
|
||||
+ 'onMouseUp',
|
||||
+ 'onKeyPress',
|
||||
+ 'onKeyDown',
|
||||
+ 'onKeyUp',
|
||||
+ ],
|
||||
+ alert: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
|
||||
+ body: ['onError', 'onLoad'],
|
||||
+ dialog: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
|
||||
+ iframe: ['onError', 'onLoad'],
|
||||
+ img: ['onError', 'onLoad'],
|
||||
+ },
|
||||
+ ],
|
||||
+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': [
|
||||
+ 'error',
|
||||
+ {
|
||||
+ ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
||||
+ ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
||||
+ li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
||||
+ table: ['grid'],
|
||||
+ td: ['gridcell'],
|
||||
@ -446,7 +369,10 @@ index 7b931fe..eaea267 100644
|
||||
+ roles: ['tabpanel'],
|
||||
+ allowExpressionValues: true,
|
||||
+ },
|
||||
+ ],
|
||||
],
|
||||
- parserOptions: {
|
||||
- ecmaFeatures: {
|
||||
- jsx: true,
|
||||
+ 'jsx-a11y/no-redundant-roles': 'error',
|
||||
+ 'jsx-a11y/no-static-element-interactions': [
|
||||
+ 'error',
|
||||
@ -459,6 +385,78 @@ index 7b931fe..eaea267 100644
|
||||
+ 'onKeyPress',
|
||||
+ 'onKeyDown',
|
||||
+ 'onKeyUp',
|
||||
+ ],
|
||||
},
|
||||
+ ],
|
||||
+ 'jsx-a11y/role-has-required-aria-props': 'error',
|
||||
+ 'jsx-a11y/role-supports-aria-props': 'error',
|
||||
+ 'jsx-a11y/scope': 'error',
|
||||
+ 'jsx-a11y/tabindex-no-positive': 'error',
|
||||
+ },
|
||||
+ },
|
||||
+ strict: {
|
||||
+ plugins: ['jsx-a11y'],
|
||||
+ parserOptions: {
|
||||
+ ecmaFeatures: {
|
||||
+ jsx: true,
|
||||
},
|
||||
- rules: {
|
||||
- 'jsx-a11y/alt-text': 'error',
|
||||
- 'jsx-a11y/anchor-has-content': 'error',
|
||||
- 'jsx-a11y/anchor-is-valid': 'error',
|
||||
- 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
||||
- 'jsx-a11y/aria-props': 'error',
|
||||
- 'jsx-a11y/aria-proptypes': 'error',
|
||||
- 'jsx-a11y/aria-role': 'error',
|
||||
- 'jsx-a11y/aria-unsupported-elements': 'error',
|
||||
- 'jsx-a11y/autocomplete-valid': 'error',
|
||||
- 'jsx-a11y/click-events-have-key-events': 'error',
|
||||
- 'jsx-a11y/control-has-associated-label': ['off', {
|
||||
+ },
|
||||
+ rules: {
|
||||
+ 'jsx-a11y/alt-text': 'error',
|
||||
+ 'jsx-a11y/anchor-has-content': 'error',
|
||||
+ 'jsx-a11y/anchor-is-valid': 'error',
|
||||
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
||||
+ 'jsx-a11y/aria-props': 'error',
|
||||
+ 'jsx-a11y/aria-proptypes': 'error',
|
||||
+ 'jsx-a11y/aria-role': 'error',
|
||||
+ 'jsx-a11y/aria-unsupported-elements': 'error',
|
||||
+ 'jsx-a11y/autocomplete-valid': 'error',
|
||||
+ 'jsx-a11y/click-events-have-key-events': 'error',
|
||||
+ 'jsx-a11y/control-has-associated-label': [
|
||||
+ 'off',
|
||||
+ {
|
||||
ignoreElements: [
|
||||
'audio',
|
||||
'canvas',
|
||||
@@ -241,56 +263,63 @@ module.exports = {
|
||||
'tree',
|
||||
'treegrid',
|
||||
],
|
||||
- includeRoles: [
|
||||
- 'alert',
|
||||
- 'dialog',
|
||||
+ includeRoles: ['alert', 'dialog'],
|
||||
+ },
|
||||
+ ],
|
||||
+ 'jsx-a11y/heading-has-content': 'error',
|
||||
+ 'jsx-a11y/html-has-lang': 'error',
|
||||
+ 'jsx-a11y/iframe-has-title': 'error',
|
||||
+ 'jsx-a11y/img-redundant-alt': 'error',
|
||||
+ 'jsx-a11y/interactive-supports-focus': [
|
||||
+ 'error',
|
||||
+ {
|
||||
+ tabbable: [
|
||||
+ 'button',
|
||||
+ 'checkbox',
|
||||
+ 'link',
|
||||
+ 'progressbar',
|
||||
+ 'searchbox',
|
||||
+ 'slider',
|
||||
+ 'spinbutton',
|
||||
+ 'switch',
|
||||
+ 'textbox',
|
||||
],
|
||||
- }],
|
||||
- 'jsx-a11y/heading-has-content': 'error',
|
||||
@ -480,44 +478,7 @@ index 7b931fe..eaea267 100644
|
||||
- 'textbox',
|
||||
- ],
|
||||
- },
|
||||
+ },
|
||||
+ ],
|
||||
+ 'jsx-a11y/role-has-required-aria-props': 'error',
|
||||
+ 'jsx-a11y/role-supports-aria-props': 'error',
|
||||
+ 'jsx-a11y/scope': 'error',
|
||||
+ 'jsx-a11y/tabindex-no-positive': 'error',
|
||||
+ },
|
||||
+ },
|
||||
+ strict: {
|
||||
+ plugins: [
|
||||
+ 'jsx-a11y',
|
||||
+ ],
|
||||
+ parserOptions: {
|
||||
+ ecmaFeatures: {
|
||||
+ jsx: true,
|
||||
+ },
|
||||
+ },
|
||||
+ rules: {
|
||||
+ 'jsx-a11y/alt-text': 'error',
|
||||
+ 'jsx-a11y/anchor-has-content': 'error',
|
||||
+ 'jsx-a11y/anchor-is-valid': 'error',
|
||||
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
||||
+ 'jsx-a11y/aria-props': 'error',
|
||||
+ 'jsx-a11y/aria-proptypes': 'error',
|
||||
+ 'jsx-a11y/aria-role': 'error',
|
||||
+ 'jsx-a11y/aria-unsupported-elements': 'error',
|
||||
+ 'jsx-a11y/autocomplete-valid': 'error',
|
||||
+ 'jsx-a11y/click-events-have-key-events': 'error',
|
||||
+ 'jsx-a11y/control-has-associated-label': ['off', {
|
||||
+ ignoreElements: [
|
||||
+ 'audio',
|
||||
+ 'canvas',
|
||||
+ 'embed',
|
||||
+ 'input',
|
||||
+ 'textarea',
|
||||
+ 'tr',
|
||||
+ 'video',
|
||||
],
|
||||
- ],
|
||||
- 'jsx-a11y/label-has-for': 'off',
|
||||
- 'jsx-a11y/label-has-associated-control': 'error',
|
||||
- 'jsx-a11y/media-has-caption': 'error',
|
||||
@ -533,18 +494,7 @@ index 7b931fe..eaea267 100644
|
||||
- iframe: ['onError', 'onLoad'],
|
||||
- img: ['onError', 'onLoad'],
|
||||
- },
|
||||
+ ignoreRoles: [
|
||||
+ 'grid',
|
||||
+ 'listbox',
|
||||
+ 'menu',
|
||||
+ 'menubar',
|
||||
+ 'radiogroup',
|
||||
+ 'row',
|
||||
+ 'tablist',
|
||||
+ 'toolbar',
|
||||
+ 'tree',
|
||||
+ 'treegrid',
|
||||
],
|
||||
- ],
|
||||
- 'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
|
||||
- 'jsx-a11y/no-noninteractive-tabindex': 'error',
|
||||
- 'jsx-a11y/no-redundant-roles': 'error',
|
||||
@ -554,29 +504,6 @@ index 7b931fe..eaea267 100644
|
||||
- 'jsx-a11y/scope': 'error',
|
||||
- 'jsx-a11y/tabindex-no-positive': 'error',
|
||||
- },
|
||||
+ includeRoles: [
|
||||
+ 'alert',
|
||||
+ 'dialog',
|
||||
+ ],
|
||||
+ }],
|
||||
+ 'jsx-a11y/heading-has-content': 'error',
|
||||
+ 'jsx-a11y/html-has-lang': 'error',
|
||||
+ 'jsx-a11y/iframe-has-title': 'error',
|
||||
+ 'jsx-a11y/img-redundant-alt': 'error',
|
||||
+ 'jsx-a11y/interactive-supports-focus': [
|
||||
+ 'error',
|
||||
+ {
|
||||
+ tabbable: [
|
||||
+ 'button',
|
||||
+ 'checkbox',
|
||||
+ 'link',
|
||||
+ 'progressbar',
|
||||
+ 'searchbox',
|
||||
+ 'slider',
|
||||
+ 'spinbutton',
|
||||
+ 'switch',
|
||||
+ 'textbox',
|
||||
+ ],
|
||||
+ },
|
||||
+ ],
|
||||
+ 'jsx-a11y/label-has-for': 'off',
|
||||
|
@ -1,91 +1,91 @@
|
||||
diff --git a/.eslintrc b/.eslintrc
|
||||
deleted file mode 100644
|
||||
index 4991f200..00000000
|
||||
index d10247d2..00000000
|
||||
--- a/.eslintrc
|
||||
+++ /dev/null
|
||||
@@ -1,82 +0,0 @@
|
||||
-{
|
||||
- "root": true,
|
||||
- "extends": ["airbnb-base", "plugin:eslint-plugin/recommended"],
|
||||
- "plugins": ["eslint-plugin"],
|
||||
- "env": {
|
||||
- "es6": true,
|
||||
- "node": true
|
||||
- },
|
||||
- "parserOptions": {
|
||||
- "ecmaVersion": 6,
|
||||
- "ecmaFeatures": {
|
||||
- "jsx": true
|
||||
- },
|
||||
- "sourceType": "script",
|
||||
- },
|
||||
- "ignorePatterns": [
|
||||
- "coverage/",
|
||||
- ".nyc_output/",
|
||||
- ],
|
||||
- "rules": {
|
||||
- "comma-dangle": [2, "always-multiline"],
|
||||
- "object-shorthand": [2, "always", {
|
||||
- "ignoreConstructors": false,
|
||||
- "avoidQuotes": false, // this is the override vs airbnb
|
||||
- }],
|
||||
- "max-len": [2, 120, {
|
||||
- "ignoreStrings": true,
|
||||
- "ignoreTemplateLiterals": true,
|
||||
- "ignoreComments": true,
|
||||
- }],
|
||||
- "consistent-return": 0,
|
||||
- "root": true,
|
||||
- "extends": ["airbnb-base", "plugin:eslint-plugin/recommended"],
|
||||
- "plugins": ["eslint-plugin"],
|
||||
- "env": {
|
||||
- "es6": true,
|
||||
- "node": true
|
||||
- },
|
||||
- "parserOptions": {
|
||||
- "ecmaVersion": 6,
|
||||
- "ecmaFeatures": {
|
||||
- "jsx": true
|
||||
- },
|
||||
- "sourceType": "script",
|
||||
- },
|
||||
- "ignorePatterns": [
|
||||
- "coverage/",
|
||||
- ".nyc_output/",
|
||||
- ],
|
||||
- "rules": {
|
||||
- "comma-dangle": [2, "always-multiline"],
|
||||
- "object-shorthand": [2, "always", {
|
||||
- "ignoreConstructors": false,
|
||||
- "avoidQuotes": false, // this is the override vs airbnb
|
||||
- }],
|
||||
- "max-len": [2, 120, {
|
||||
- "ignoreStrings": true,
|
||||
- "ignoreTemplateLiterals": true,
|
||||
- "ignoreComments": true,
|
||||
- }],
|
||||
- "consistent-return": 0,
|
||||
-
|
||||
- "prefer-destructuring": [2, { "array": false, "object": false }, { "enforceForRenamedProperties": false }],
|
||||
- "prefer-object-spread": 0, // until node 8 is required
|
||||
- "prefer-rest-params": 0, // until node 6 is required
|
||||
- "prefer-spread": 0, // until node 6 is required
|
||||
- "function-call-argument-newline": 1, // TODO: enable
|
||||
- "function-paren-newline": 0,
|
||||
- "no-plusplus": [2, {"allowForLoopAfterthoughts": true}],
|
||||
- "no-param-reassign": 1,
|
||||
- "no-restricted-syntax": [2, {
|
||||
- "selector": "ObjectPattern",
|
||||
- "message": "Object destructuring is not compatible with Node v4"
|
||||
- }],
|
||||
- "strict": [2, "safe"],
|
||||
- "valid-jsdoc": [2, {
|
||||
- "requireReturn": false,
|
||||
- "requireParamDescription": false,
|
||||
- "requireReturnDescription": false,
|
||||
- }],
|
||||
- "prefer-destructuring": [2, { "array": false, "object": false }, { "enforceForRenamedProperties": false }],
|
||||
- "prefer-object-spread": 0, // until node 8 is required
|
||||
- "prefer-rest-params": 0, // until node 6 is required
|
||||
- "prefer-spread": 0, // until node 6 is required
|
||||
- "function-call-argument-newline": 1, // TODO: enable
|
||||
- "function-paren-newline": 0,
|
||||
- "no-plusplus": [2, {"allowForLoopAfterthoughts": true}],
|
||||
- "no-param-reassign": 1,
|
||||
- "no-restricted-syntax": [2, {
|
||||
- "selector": "ObjectPattern",
|
||||
- "message": "Object destructuring is not compatible with Node v4"
|
||||
- }],
|
||||
- "strict": [2, "safe"],
|
||||
- "valid-jsdoc": [2, {
|
||||
- "requireReturn": false,
|
||||
- "requireParamDescription": false,
|
||||
- "requireReturnDescription": false,
|
||||
- }],
|
||||
-
|
||||
- "eslint-plugin/consistent-output": 0,
|
||||
- "eslint-plugin/require-meta-docs-description": [2, { "pattern": "^(Enforce|Require|Disallow)" }],
|
||||
- "eslint-plugin/require-meta-schema": 0,
|
||||
- "eslint-plugin/require-meta-type": 0
|
||||
- },
|
||||
- "overrides": [
|
||||
- {
|
||||
- "files": "tests/**",
|
||||
- "rules": {
|
||||
- "no-template-curly-in-string": 1,
|
||||
- },
|
||||
- },
|
||||
- {
|
||||
- "files": "markdown.config.js",
|
||||
- "rules": {
|
||||
- "no-console": 0,
|
||||
- },
|
||||
- },
|
||||
- {
|
||||
- "files": ".github/workflows/*.js",
|
||||
- "parserOptions": {
|
||||
- "ecmaVersion": 2019,
|
||||
- },
|
||||
- "rules": {
|
||||
- "camelcase": 0,
|
||||
- "no-console": 0,
|
||||
- "no-restricted-syntax": 0,
|
||||
- },
|
||||
- },
|
||||
- ],
|
||||
-}
|
||||
- "eslint-plugin/consistent-output": 0,
|
||||
- "eslint-plugin/require-meta-docs-description": [2, { "pattern": "^(Enforce|Require|Disallow)" }],
|
||||
- "eslint-plugin/require-meta-schema": 0,
|
||||
- "eslint-plugin/require-meta-type": 0
|
||||
- },
|
||||
- "overrides": [
|
||||
- {
|
||||
- "files": "tests/**",
|
||||
- "rules": {
|
||||
- "no-template-curly-in-string": 1,
|
||||
- },
|
||||
- },
|
||||
- {
|
||||
- "files": "markdown.config.js",
|
||||
- "rules": {
|
||||
- "no-console": 0,
|
||||
- },
|
||||
- },
|
||||
- {
|
||||
- "files": ".github/workflows/*.js",
|
||||
- "parserOptions": {
|
||||
- "ecmaVersion": 2019,
|
||||
- },
|
||||
- "rules": {
|
||||
- "camelcase": 0,
|
||||
- "no-console": 0,
|
||||
- "no-restricted-syntax": 0,
|
||||
- },
|
||||
- },
|
||||
- ],
|
||||
- }
|
||||
diff --git a/index.js b/index.js
|
||||
index 4140c6c8..03e623af 100644
|
||||
--- a/index.js
|
||||
@ -144,7 +144,7 @@ index 4140c6c8..03e623af 100644
|
||||
+ }),
|
||||
};
|
||||
diff --git a/lib/rules/button-has-type.js b/lib/rules/button-has-type.js
|
||||
index 204a33c4..01d992c2 100644
|
||||
index d4059606..982dd343 100644
|
||||
--- a/lib/rules/button-has-type.js
|
||||
+++ b/lib/rules/button-has-type.js
|
||||
@@ -5,8 +5,7 @@
|
||||
@ -158,7 +158,7 @@ index 204a33c4..01d992c2 100644
|
||||
const isCreateElement = require('../util/isCreateElement');
|
||||
const report = require('../util/report');
|
||||
diff --git a/lib/rules/jsx-fragments.js b/lib/rules/jsx-fragments.js
|
||||
index 38b4dd8b..d0575572 100644
|
||||
index 4dadb076..de01ae32 100644
|
||||
--- a/lib/rules/jsx-fragments.js
|
||||
+++ b/lib/rules/jsx-fragments.js
|
||||
@@ -5,7 +5,7 @@
|
||||
@ -171,7 +171,7 @@ index 38b4dd8b..d0575572 100644
|
||||
const variableUtil = require('../util/variable');
|
||||
const testReactVersion = require('../util/version').testReactVersion;
|
||||
diff --git a/lib/rules/jsx-key.js b/lib/rules/jsx-key.js
|
||||
index 7ea874d0..48df0dba 100644
|
||||
index feee7ad5..c2bd9265 100644
|
||||
--- a/lib/rules/jsx-key.js
|
||||
+++ b/lib/rules/jsx-key.js
|
||||
@@ -5,8 +5,7 @@
|
||||
@ -185,7 +185,7 @@ index 7ea874d0..48df0dba 100644
|
||||
const docsUrl = require('../util/docsUrl');
|
||||
const pragmaUtil = require('../util/pragma');
|
||||
diff --git a/lib/rules/jsx-no-bind.js b/lib/rules/jsx-no-bind.js
|
||||
index 17e56e2e..cb6dec1a 100644
|
||||
index 4d6e349d..6cc8fbc3 100644
|
||||
--- a/lib/rules/jsx-no-bind.js
|
||||
+++ b/lib/rules/jsx-no-bind.js
|
||||
@@ -7,7 +7,7 @@
|
||||
@ -211,7 +211,7 @@ index efeef403..33df4653 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 3ca1724e..faf58f91 100644
|
||||
index f811e16c..ebbde786 100644
|
||||
--- a/lib/rules/jsx-sort-props.js
|
||||
+++ b/lib/rules/jsx-sort-props.js
|
||||
@@ -5,7 +5,7 @@
|
||||
@ -224,7 +224,7 @@ index 3ca1724e..faf58f91 100644
|
||||
const toSorted = require('array.prototype.tosorted');
|
||||
|
||||
diff --git a/lib/rules/no-namespace.js b/lib/rules/no-namespace.js
|
||||
index d7559f5e..fbfad23a 100644
|
||||
index 20ca5d93..22eb516f 100644
|
||||
--- a/lib/rules/no-namespace.js
|
||||
+++ b/lib/rules/no-namespace.js
|
||||
@@ -5,7 +5,7 @@
|
||||
@ -237,10 +237,10 @@ index d7559f5e..fbfad23a 100644
|
||||
const isCreateElement = require('../util/isCreateElement');
|
||||
const report = require('../util/report');
|
||||
diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js
|
||||
index 9491f9c6..44396948 100644
|
||||
index 3e8c6de1..0b3224a3 100644
|
||||
--- a/lib/rules/no-unknown-property.js
|
||||
+++ b/lib/rules/no-unknown-property.js
|
||||
@@ -543,7 +543,7 @@ module.exports = {
|
||||
@@ -544,7 +544,7 @@ module.exports = {
|
||||
|
||||
create(context) {
|
||||
function getIgnoreConfig() {
|
||||
@ -249,20 +249,11 @@ index 9491f9c6..44396948 100644
|
||||
}
|
||||
|
||||
function getRequireDataLowercase() {
|
||||
@@ -556,7 +556,7 @@ module.exports = {
|
||||
JSXAttribute(node) {
|
||||
const ignoreNames = getIgnoreConfig();
|
||||
const actualName = context.getSourceCode().getText(node.name);
|
||||
- if (ignoreNames.indexOf(actualName) >= 0) {
|
||||
+ if (ignoreNames.includes(actualName)) {
|
||||
return;
|
||||
}
|
||||
const name = normalizeAttributeCase(actualName);
|
||||
diff --git a/lib/util/annotations.js b/lib/util/annotations.js
|
||||
index 60aaef8c..ad8dc0bf 100644
|
||||
index 24b18074..cc7e6faa 100644
|
||||
--- a/lib/util/annotations.js
|
||||
+++ b/lib/util/annotations.js
|
||||
@@ -27,6 +27,6 @@ function isAnnotatedFunctionPropsDeclaration(node, context) {
|
||||
@@ -29,6 +29,6 @@ function isAnnotatedFunctionPropsDeclaration(node, context) {
|
||||
return (isAnnotated && (isDestructuredProps || isProps));
|
||||
}
|
||||
|
||||
@ -271,19 +262,131 @@ index 60aaef8c..ad8dc0bf 100644
|
||||
isAnnotatedFunctionPropsDeclaration,
|
||||
};
|
||||
diff --git a/lib/util/ast.js b/lib/util/ast.js
|
||||
index fd6019a3..3cbc293e 100644
|
||||
index 5664dcb5..82f81709 100644
|
||||
--- a/lib/util/ast.js
|
||||
+++ b/lib/util/ast.js
|
||||
@@ -4,7 +4,7 @@
|
||||
@@ -4,12 +4,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
-const estraverse = require('estraverse');
|
||||
-const eslintUtil = require('./eslint');
|
||||
-
|
||||
-const getFirstTokens = eslintUtil.getFirstTokens;
|
||||
-const getScope = eslintUtil.getScope;
|
||||
-const getSourceCode = eslintUtil.getSourceCode;
|
||||
+import estraverse from 'estraverse';
|
||||
+import { getFirstTokens, getScope, getSourceCode } from './eslint.js';
|
||||
// const pragmaUtil = require('./pragma');
|
||||
|
||||
/**
|
||||
@@ -428,7 +428,7 @@ function isTSTypeParameterInstantiation(node) {
|
||||
@@ -19,11 +15,15 @@ const getSourceCode = eslintUtil.getSourceCode;
|
||||
* @param {Object} visitor Visitor Object for estraverse
|
||||
*/
|
||||
function traverse(ASTnode, visitor) {
|
||||
- const opts = Object.assign({}, {
|
||||
- fallback(node) {
|
||||
- return Object.keys(node).filter((key) => key === 'children' || key === 'argument');
|
||||
+ const opts = Object.assign(
|
||||
+ {},
|
||||
+ {
|
||||
+ fallback(node) {
|
||||
+ return Object.keys(node).filter(key => key === 'children' || key === 'argument');
|
||||
+ },
|
||||
},
|
||||
- }, visitor);
|
||||
+ visitor,
|
||||
+ );
|
||||
|
||||
opts.keys = Object.assign({}, visitor.keys, {
|
||||
JSXElement: ['children'],
|
||||
@@ -56,8 +56,8 @@ function loopNodes(nodes) {
|
||||
*/
|
||||
function findReturnStatement(node) {
|
||||
if (
|
||||
- (!node.value || !node.value.body || !node.value.body.body)
|
||||
- && (!node.body || !node.body.body)
|
||||
+ (!node.value || !node.value.body || !node.value.body.body) &&
|
||||
+ (!node.body || !node.body.body)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
@@ -110,10 +110,10 @@ function traverseReturns(ASTNode, context, onReturn) {
|
||||
*/
|
||||
|
||||
if (
|
||||
- nodeType !== 'FunctionExpression'
|
||||
- && nodeType !== 'FunctionDeclaration'
|
||||
- && nodeType !== 'ArrowFunctionExpression'
|
||||
- && nodeType !== 'MethodDefinition'
|
||||
+ nodeType !== 'FunctionExpression' &&
|
||||
+ nodeType !== 'FunctionDeclaration' &&
|
||||
+ nodeType !== 'ArrowFunctionExpression' &&
|
||||
+ nodeType !== 'MethodDefinition'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -196,13 +196,8 @@ function getFirstNodeInLine(context, node) {
|
||||
let lines;
|
||||
do {
|
||||
token = sourceCode.getTokenBefore(token);
|
||||
- lines = token.type === 'JSXText'
|
||||
- ? token.value.split('\n')
|
||||
- : null;
|
||||
- } while (
|
||||
- token.type === 'JSXText'
|
||||
- && /^\s*$/.test(lines[lines.length - 1])
|
||||
- );
|
||||
+ lines = token.type === 'JSXText' ? token.value.split('\n') : null;
|
||||
+ } while (token.type === 'JSXText' && /^\s*$/.test(lines[lines.length - 1]));
|
||||
return token;
|
||||
}
|
||||
|
||||
@@ -291,10 +286,9 @@ function stripQuotes(string) {
|
||||
function getKeyValue(context, node) {
|
||||
if (node.type === 'ObjectTypeProperty') {
|
||||
const tokens = getFirstTokens(context, node, 2);
|
||||
- return (tokens[0].value === '+' || tokens[0].value === '-'
|
||||
+ return tokens[0].value === '+' || tokens[0].value === '-'
|
||||
? tokens[1].value
|
||||
- : stripQuotes(tokens[0].value)
|
||||
- );
|
||||
+ : stripQuotes(tokens[0].value);
|
||||
}
|
||||
if (node.type === 'GenericTypeAnnotation') {
|
||||
return node.id.name;
|
||||
@@ -321,9 +315,14 @@ function isParenthesized(context, node) {
|
||||
const previousToken = sourceCode.getTokenBefore(node);
|
||||
const nextToken = sourceCode.getTokenAfter(node);
|
||||
|
||||
- return !!previousToken && !!nextToken
|
||||
- && previousToken.value === '(' && previousToken.range[1] <= node.range[0]
|
||||
- && nextToken.value === ')' && nextToken.range[0] >= node.range[1];
|
||||
+ return (
|
||||
+ !!previousToken &&
|
||||
+ !!nextToken &&
|
||||
+ previousToken.value === '(' &&
|
||||
+ previousToken.range[1] <= node.range[0] &&
|
||||
+ nextToken.value === ')' &&
|
||||
+ nextToken.range[0] >= node.range[1]
|
||||
+ );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -333,9 +332,9 @@ function isParenthesized(context, node) {
|
||||
*/
|
||||
function isAssignmentLHS(node) {
|
||||
return (
|
||||
- node.parent
|
||||
- && node.parent.type === 'AssignmentExpression'
|
||||
- && node.parent.left === node
|
||||
+ node.parent &&
|
||||
+ node.parent.type === 'AssignmentExpression' &&
|
||||
+ node.parent.left === node
|
||||
);
|
||||
}
|
||||
|
||||
@@ -434,7 +433,7 @@ function isTSTypeParameterInstantiation(node) {
|
||||
return nodeType === 'TSTypeParameterInstantiation';
|
||||
}
|
||||
|
||||
@ -293,7 +396,7 @@ index fd6019a3..3cbc293e 100644
|
||||
findReturnStatement,
|
||||
getFirstNodeInLine,
|
||||
diff --git a/lib/util/jsx.js b/lib/util/jsx.js
|
||||
index 55073bfe..efc07af1 100644
|
||||
index 07a09a80..0b9b139f 100644
|
||||
--- a/lib/util/jsx.js
|
||||
+++ b/lib/util/jsx.js
|
||||
@@ -4,7 +4,7 @@
|
||||
|
1901
pnpm-lock.yaml
generated
1901
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -135,7 +135,6 @@ async function main() {
|
||||
console.log('Building packages...');
|
||||
await Promise.all([
|
||||
bundle('./packages/eslint-plugin-react/index.js'),
|
||||
bundle('./packages/eslint-plugin-import/src/index.js'),
|
||||
bundle('./packages/eslint-plugin-jsx-a11y/src/index.js'),
|
||||
bundle('./packages/eslint-plugin-react-hooks/index.ts'),
|
||||
bundle('./packages/eslint-plugin-n/lib/index.js', './dist/eslint-plugin-n/index.js'),
|
||||
|
@ -18,11 +18,6 @@ export function dts({
|
||||
filePath: source,
|
||||
failOnClass: false,
|
||||
output: {
|
||||
inlineDeclareExternals: false,
|
||||
inlineDeclareGlobals: false,
|
||||
sortNodes: false,
|
||||
noBanner: false,
|
||||
respectPreserveConstEnum: false,
|
||||
exportReferencedTypes: true,
|
||||
},
|
||||
};
|
||||
|
@ -21,7 +21,6 @@ pull() {
|
||||
}
|
||||
|
||||
pull import-js eslint-import-resolver-typescript
|
||||
pull import-js eslint-plugin-import
|
||||
pull jsx-eslint eslint-plugin-jsx-a11y
|
||||
pull eslint-community eslint-plugin-n
|
||||
pull jsx-eslint eslint-plugin-react
|
||||
|
@ -1,33 +1,33 @@
|
||||
{
|
||||
"eslint-plugin-import": {
|
||||
"hash": "c0ac54b8a721c2b1c9048838acc4d6282f4fe7a7",
|
||||
"date": "2024-04-25T10:57:27-07:00",
|
||||
"hash": "6554bd5c30976290024cecc44ef1e96746cf3cf7",
|
||||
"date": "2024-05-23T12:47:41-07:00",
|
||||
"committer": "Jordan Harband",
|
||||
"subject": "[Dev Deps] pin `find-babel-config` to v1.2.0, due to a breaking change in v1.2.1"
|
||||
"subject": "[meta] add `repository.directory` field"
|
||||
},
|
||||
"eslint-import-resolver-typescript": {
|
||||
"hash": "5c4f28a97d268a9b74fe8a9e5ab965f43cc7524e",
|
||||
"date": "2024-05-01T01:20:42+00:00",
|
||||
"hash": "ca11f1c538714252ff058a8e1c680796ee5775d0",
|
||||
"date": "2024-06-01T03:27:29+00:00",
|
||||
"committer": "GitHub",
|
||||
"subject": "fix(deps): update dependency get-tsconfig to ^4.7.3 (#280)"
|
||||
"subject": "chore(deps): update dependency eslint to ^8.57.0 (#287)"
|
||||
},
|
||||
"eslint-plugin-jsx-a11y": {
|
||||
"hash": "0d5321a5457c5f0da0ca216053cc5b4f571b53ae",
|
||||
"date": "2024-01-27T22:18:19-08:00",
|
||||
"hash": "5d1440825a8838ae10dc94cc3a4a7e1e967644b4",
|
||||
"date": "2024-06-10T09:28:24-07:00",
|
||||
"committer": "Jordan Harband",
|
||||
"subject": "[Deps] update `@babel/runtime`, `safe-regex-test`"
|
||||
"subject": "[Deps] update `@babel/runtime`, `array-includes`, `es-iterator-helpers`, `hasown`, `object.fromentries`, `safe-regex-test`"
|
||||
},
|
||||
"eslint-plugin-n": {
|
||||
"hash": "ecdf019c54c5bd720c20d2ea21886559c15f3205",
|
||||
"date": "2024-04-30T17:47:30+08:00",
|
||||
"hash": "67bbfdf3c6862dcbfe455a4afbd83fa60f9d1ea4",
|
||||
"date": "2024-06-14T09:43:13+08:00",
|
||||
"committer": "GitHub",
|
||||
"subject": "fix: remove invalid es-builtins (#258)"
|
||||
"subject": "chore(master): release 17.9.0 (#299)"
|
||||
},
|
||||
"eslint-plugin-react": {
|
||||
"hash": "03cd4b578931714e8a3b70bf49998d97a6c6d811",
|
||||
"date": "2024-04-28T11:18:14-07:00",
|
||||
"hash": "393bfa2fc071bfd08cef2327790e2ccc95507d72",
|
||||
"date": "2024-06-12T20:49:45-04:00",
|
||||
"committer": "Jordan Harband",
|
||||
"subject": "Merge tag 'v7.34.1' into HEAD"
|
||||
"subject": "[Fix] `no-object-type-as-default-prop`: enable rule for components with many parameters"
|
||||
},
|
||||
"jsx-ast-utils": {
|
||||
"hash": "5943318eaf23764eec3ff397ebb969613d728a95",
|
||||
|
12
src/index.ts
12
src/index.ts
@ -3,13 +3,13 @@ import './redirect';
|
||||
import fs from 'node:fs';
|
||||
import type { Rule } from 'eslint';
|
||||
import type { ESLintUtils } from '@typescript-eslint/utils';
|
||||
import type { ESLintConfig, Rules } from 'eslint-define-config';
|
||||
import type { ESLintConfig, Rules } from '@aet/eslint-define-config';
|
||||
// import findCacheDirectory from 'find-cache-dir';
|
||||
import { typescriptRules } from './presets/typescript';
|
||||
import { unicornRules } from './presets/unicorn';
|
||||
import { eslintRules } from './presets/eslint';
|
||||
import { reactRules } from './presets/react';
|
||||
import { importRules } from './presets/import';
|
||||
import { importRules } from './presets/import-x';
|
||||
import { jsDocRules } from './presets/jsdoc';
|
||||
import { graphqlRules } from './presets/graphql';
|
||||
import { localRules } from './presets/local';
|
||||
@ -36,12 +36,6 @@ const ensureArray = <T>(value?: T | T[]): T[] =>
|
||||
type RuleLevel = 'error' | 'warn' | 'off' | 0 | 1 | 2;
|
||||
type RuleEntry<Options> = RuleLevel | [RuleLevel, Partial<Options>];
|
||||
|
||||
declare module 'eslint-define-config/src/rules/react/no-unknown-property.d.ts' {
|
||||
export interface NoUnknownPropertyOption {
|
||||
extends: ('next' | 'emotion')[];
|
||||
}
|
||||
}
|
||||
|
||||
export interface LocalRuleOptions {
|
||||
/** Bans import from the specifier '.' and '..' and replaces it with '.+/index' */
|
||||
'rules/no-import-dot': RuleEntry<unknown>;
|
||||
@ -72,7 +66,7 @@ export type InputConfig = Omit<ESLintConfig, 'rules'> & {
|
||||
* Rules.
|
||||
* @see [Rules](https://eslint.org/docs/latest/user-guide/configuring/rules)
|
||||
*/
|
||||
rules?: RuleOptions;
|
||||
rules?: Partial<RuleOptions>;
|
||||
|
||||
/**
|
||||
* Glob pattern to find paths to custom rule files in JavaScript or TypeScript.
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { error, warn, off } from '../constants';
|
||||
import { EslintRules } from 'eslint-define-config/src/rules/eslint';
|
||||
import { EslintRulesObject } from '@aet/eslint-define-config/src/rules/eslint';
|
||||
import restrictedGlobals from './_restrictedGlobals.json';
|
||||
|
||||
export const eslintRules: Partial<EslintRules> = {
|
||||
export const eslintRules: Partial<EslintRulesObject> = {
|
||||
'arrow-body-style': [error, 'as-needed'],
|
||||
'class-methods-use-this': off,
|
||||
'func-style': [error, 'declaration', { allowArrowFunctions: true }],
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { GraphQLRules } from 'eslint-define-config/src/rules/graphql-eslint';
|
||||
import { GraphQLRulesObject } from '@aet/eslint-define-config/src/rules/graphql-eslint';
|
||||
|
||||
// https://the-guild.dev/graphql/eslint/rules
|
||||
export const graphqlRules: Partial<GraphQLRules> = {};
|
||||
export const graphqlRules: Partial<GraphQLRulesObject> = {};
|
||||
|
8
src/presets/import-x.ts
Normal file
8
src/presets/import-x.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { error, off } from '../constants';
|
||||
import { ImportXRulesObject } from '@aet/eslint-define-config/src/rules/import-x';
|
||||
|
||||
export const importRules: Partial<ImportXRulesObject> = {
|
||||
'import-x/export': off,
|
||||
'import-x/no-duplicates': error,
|
||||
'import-x/order': [error, { groups: ['builtin', 'external'] }],
|
||||
};
|
@ -1,8 +0,0 @@
|
||||
import { error, off } from '../constants';
|
||||
import { ImportRules } from 'eslint-define-config/src/rules/import';
|
||||
|
||||
export const importRules: Partial<ImportRules> = {
|
||||
'import/export': off,
|
||||
'import/no-duplicates': error,
|
||||
'import/order': [error, { groups: ['builtin', 'external'] }],
|
||||
};
|
@ -1,3 +1,3 @@
|
||||
import { JSDocRules } from 'eslint-define-config/src/rules/jsdoc';
|
||||
import { JSDocRulesObject } from '@aet/eslint-define-config/src/rules/jsdoc';
|
||||
|
||||
export const jsDocRules: Partial<JSDocRules> = {};
|
||||
export const jsDocRules: Partial<JSDocRulesObject> = {};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { error, off } from '../constants';
|
||||
import { ReactRules } from 'eslint-define-config/src/rules/react';
|
||||
import { ReactRulesObject } from '@aet/eslint-define-config/src/rules/react';
|
||||
|
||||
export const reactRules: Partial<ReactRules> = {
|
||||
export const reactRules: Partial<ReactRulesObject> = {
|
||||
'react/display-name': off,
|
||||
'react/no-children-prop': error,
|
||||
'react/prop-types': off,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { error, off, warn } from '../constants';
|
||||
import type { TypeScriptRules } from 'eslint-define-config/src/rules/typescript-eslint';
|
||||
import type { TypeScriptRulesObject } from '@aet/eslint-define-config/src/rules/typescript-eslint';
|
||||
|
||||
export const typescriptRules: Partial<TypeScriptRules> = {
|
||||
export const typescriptRules: Partial<TypeScriptRulesObject> = {
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
error,
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { error, warn } from '../constants';
|
||||
import { UnicornRules } from 'eslint-define-config/src/rules/unicorn';
|
||||
import { UnicornRulesObject } from '@aet/eslint-define-config/src/rules/unicorn';
|
||||
|
||||
const suggest = (suggest: string) => ({ suggest, fix: false });
|
||||
|
||||
// https://github.com/sindresorhus/eslint-plugin-unicorn/tree/28e7498ad06679bb92343db53bb40a7b5ba2990a
|
||||
export const unicornRules: Partial<UnicornRules> = {
|
||||
export const unicornRules: Partial<UnicornRulesObject> = {
|
||||
'unicorn/better-regex': error,
|
||||
'unicorn/consistent-function-scoping': warn,
|
||||
'unicorn/escape-case': error,
|
||||
|
Loading…
x
Reference in New Issue
Block a user