@uva-glass/eslint-config 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,81 +1,81 @@
1
- # GLASS-eslint
2
-
3
- Eslint configuration for the Glass frontend
4
-
5
- The default configuration contains linting rules for [javascript][1], [imports][2], [React][3] and [Typescript][4]. Optionally, configuration for [Node][5], and [testing][6] can be included.
6
-
7
- ## Installation and usage
8
-
9
- ### Install
10
-
11
- > **Note**
12
- >
13
- > Make sure Node >= 18 is installed
14
-
15
- ```
16
- npm i @uva-glass/eslint-config
17
- ```
18
-
19
- ### Using
20
-
21
- Create an `.eslintrc.json` file in the root of your project and add the following configuration:
22
-
23
- #### Basic
24
-
25
- ```json
26
- {
27
- "extends": ["@uva-glass/eslint-config"]
28
- }
29
- ```
30
-
31
- This will apply Eslint rules from `@typescript-eslint/recommended`, `plugin:import/recommended`, `plugin:react/recommended`, and `plugin:react/jsx-runtime`.
32
-
33
- #### Include rules for testing
34
-
35
- ```json
36
- {
37
- "extends": [
38
- "@uva-glass/eslint-config",
39
- "@uva-glass/eslint-config/testing-library-react"
40
- ]
41
- }
42
- ```
43
-
44
- ### Overriding
45
-
46
- The default set of rules is (more or less) equal to those that are available in [create-react-app][7]. The reason behind this, is that both [Lens][8] and [Prism][9] were both initially created from a create-react-app template. For an easy transition, the applicable Eslint rules were copied into this repository.
47
-
48
- Some rules might not be too specific or limiting for your code. In those cases, the default configuration can be extended or overwritten. For instance for files that are used on the command line by Jest, but are included in the regular code base:
49
-
50
- ```json
51
- {
52
- "extends": [
53
- "@uva-glass/eslint-config",
54
- "@uva-glass/eslint-config/testing-library-react"
55
- ],
56
- "overrides": [
57
- {
58
- "extends": ["@uva-glass/eslint-config/node"],
59
- "files": ["**/__mocks__/*.js"],
60
- "env": {
61
- "browser": false,
62
- "node": true
63
- },
64
- "rules": {
65
- "import/no-commonjs": "off",
66
- "import/unambiguous": "off"
67
- }
68
- }
69
- ]
70
- }
71
- ```
72
-
73
- [1]: ./base.js
74
- [2]: ./import.js
75
- [3]: ./react.js
76
- [4]: ./typescript.js
77
- [5]: ./node.js
78
- [6]: ./testing-library-react.js
79
- [7]: https://github.com/facebook/create-react-app/tree/main/packages/eslint-config-react-app
80
- [8]: https://github.com/uva/GLASS-lens
81
- [9]: https://github.com/uva/GLASS-prism
1
+ # GLASS-eslint
2
+
3
+ Eslint configuration for the Glass frontend
4
+
5
+ The default configuration contains linting rules for [javascript][1], [imports][2], [React][3] and [Typescript][4]. Optionally, configuration for [Node][5], and [testing][6] can be included.
6
+
7
+ ## Installation and usage
8
+
9
+ ### Install
10
+
11
+ > **Note**
12
+ >
13
+ > Make sure Node >= 18 is installed
14
+
15
+ ```
16
+ npm i @uva-glass/eslint-config
17
+ ```
18
+
19
+ ### Using
20
+
21
+ Create an `.eslintrc.json` file in the root of your project and add the following configuration:
22
+
23
+ #### Basic
24
+
25
+ ```json
26
+ {
27
+ "extends": ["@uva-glass/eslint-config"]
28
+ }
29
+ ```
30
+
31
+ This will apply Eslint rules from `@typescript-eslint/recommended`, `plugin:import/recommended`, `plugin:react/recommended`, and `plugin:react/jsx-runtime`.
32
+
33
+ #### Include rules for testing
34
+
35
+ ```json
36
+ {
37
+ "extends": [
38
+ "@uva-glass/eslint-config",
39
+ "@uva-glass/eslint-config/testing-library-react"
40
+ ]
41
+ }
42
+ ```
43
+
44
+ ### Overriding
45
+
46
+ The default set of rules is (more or less) equal to those that are available in [create-react-app][7]. The reason behind this, is that both [Lens][8] and [Prism][9] were both initially created from a create-react-app template. For an easy transition, the applicable Eslint rules were copied into this repository.
47
+
48
+ Some rules might not be too specific or limiting for your code. In those cases, the default configuration can be extended or overwritten. For instance for files that are used on the command line by Jest, but are included in the regular code base:
49
+
50
+ ```json
51
+ {
52
+ "extends": [
53
+ "@uva-glass/eslint-config",
54
+ "@uva-glass/eslint-config/testing-library-react"
55
+ ],
56
+ "overrides": [
57
+ {
58
+ "extends": ["@uva-glass/eslint-config/node"],
59
+ "files": ["**/__mocks__/*.js"],
60
+ "env": {
61
+ "browser": false,
62
+ "node": true
63
+ },
64
+ "rules": {
65
+ "import/no-commonjs": "off",
66
+ "import/unambiguous": "off"
67
+ }
68
+ }
69
+ ]
70
+ }
71
+ ```
72
+
73
+ [1]: ./base.js
74
+ [2]: ./import.js
75
+ [3]: ./react.js
76
+ [4]: ./typescript.js
77
+ [5]: ./node.js
78
+ [6]: ./testing-library-react.js
79
+ [7]: https://github.com/facebook/create-react-app/tree/main/packages/eslint-config-react-app
80
+ [8]: https://github.com/uva/GLASS-lens
81
+ [9]: https://github.com/uva/GLASS-prism
package/base.js CHANGED
@@ -1,89 +1,89 @@
1
- module.exports = {
2
- extends: ["eslint:recommended"],
3
- settings: { react: { version: "detect" } },
4
- rules: {
5
- "array-callback-return": "warn",
6
- "dot-location": ["warn", "property"],
7
- eqeqeq: ["warn", "smart"],
8
- "new-parens": "warn",
9
- "id-length": [
10
- "warn",
11
- { exceptions: ["t", "_"], exceptionPatterns: ["[x-z]"] },
12
- ],
13
- "no-caller": "warn",
14
- "no-cond-assign": ["warn", "except-parens"],
15
- "no-const-assign": "warn",
16
- "no-control-regex": "warn",
17
- "no-delete-var": "warn",
18
- "no-dupe-args": "warn",
19
- "no-dupe-keys": "warn",
20
- "no-duplicate-case": "warn",
21
- "no-empty-character-class": "warn",
22
- "no-empty-pattern": "warn",
23
- "no-eval": "warn",
24
- "no-ex-assign": "warn",
25
- "no-extend-native": "warn",
26
- "no-extra-bind": "warn",
27
- "no-extra-label": "warn",
28
- "no-fallthrough": "warn",
29
- "no-func-assign": "warn",
30
- "no-implied-eval": "warn",
31
- "no-invalid-regexp": "warn",
32
- "no-iterator": "warn",
33
- "no-label-var": "warn",
34
- "no-labels": ["warn", { allowLoop: true, allowSwitch: false }],
35
- "no-lone-blocks": "warn",
36
- "no-loop-func": "warn",
37
- "no-mixed-operators": [
38
- "warn",
39
- {
40
- groups: [
41
- ["&", "|", "^", "~", "<<", ">>", ">>>"],
42
- ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
43
- ["&&", "||"],
44
- ["in", "instanceof"],
45
- ],
46
- allowSamePrecedence: false,
47
- },
48
- ],
49
- "no-multi-str": "warn",
50
- "no-global-assign": "warn",
51
- "no-unsafe-negation": "warn",
52
- "no-new-func": "warn",
53
- "no-new-object": "warn",
54
- "no-new-symbol": "warn",
55
- "no-new-wrappers": "warn",
56
- "no-obj-calls": "warn",
57
- "no-octal": "warn",
58
- "no-octal-escape": "warn",
59
- "no-regex-spaces": "warn",
60
- "no-restricted-syntax": ["warn", "WithStatement"],
61
- "no-script-url": "warn",
62
- "no-self-assign": "warn",
63
- "no-self-compare": "warn",
64
- "no-sequences": "warn",
65
- "no-shadow-restricted-names": "warn",
66
- "no-sparse-arrays": "warn",
67
- "no-template-curly-in-string": "warn",
68
- "no-this-before-super": "warn",
69
- "no-throw-literal": "warn",
70
- "no-useless-computed-key": "warn",
71
- "no-useless-concat": "warn",
72
- "no-useless-escape": "warn",
73
- "no-useless-rename": [
74
- "warn",
75
- {
76
- ignoreDestructuring: false,
77
- ignoreImport: false,
78
- ignoreExport: false,
79
- },
80
- ],
81
-
82
- "no-with": "warn",
83
- "no-whitespace-before-property": "warn",
84
- "require-yield": "warn",
85
- "rest-spread-spacing": ["warn", "never"],
86
- "no-lonely-if": "warn",
87
- "no-implicit-coercion": "warn",
88
- },
89
- };
1
+ module.exports = {
2
+ extends: ["eslint:recommended"],
3
+ settings: { react: { version: "detect" } },
4
+ rules: {
5
+ "array-callback-return": "warn",
6
+ "dot-location": ["warn", "property"],
7
+ eqeqeq: ["warn", "smart"],
8
+ "new-parens": "warn",
9
+ "id-length": [
10
+ "warn",
11
+ { exceptions: ["t", "_"], exceptionPatterns: ["[x-z]"] },
12
+ ],
13
+ "no-caller": "warn",
14
+ "no-cond-assign": ["warn", "except-parens"],
15
+ "no-const-assign": "warn",
16
+ "no-control-regex": "warn",
17
+ "no-delete-var": "warn",
18
+ "no-dupe-args": "warn",
19
+ "no-dupe-keys": "warn",
20
+ "no-duplicate-case": "warn",
21
+ "no-empty-character-class": "warn",
22
+ "no-empty-pattern": "warn",
23
+ "no-eval": "warn",
24
+ "no-ex-assign": "warn",
25
+ "no-extend-native": "warn",
26
+ "no-extra-bind": "warn",
27
+ "no-extra-label": "warn",
28
+ "no-fallthrough": "warn",
29
+ "no-func-assign": "warn",
30
+ "no-implied-eval": "warn",
31
+ "no-invalid-regexp": "warn",
32
+ "no-iterator": "warn",
33
+ "no-label-var": "warn",
34
+ "no-labels": ["warn", { allowLoop: true, allowSwitch: false }],
35
+ "no-lone-blocks": "warn",
36
+ "no-loop-func": "warn",
37
+ "no-mixed-operators": [
38
+ "warn",
39
+ {
40
+ groups: [
41
+ ["&", "|", "^", "~", "<<", ">>", ">>>"],
42
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
43
+ ["&&", "||"],
44
+ ["in", "instanceof"],
45
+ ],
46
+ allowSamePrecedence: false,
47
+ },
48
+ ],
49
+ "no-multi-str": "warn",
50
+ "no-global-assign": "warn",
51
+ "no-unsafe-negation": "warn",
52
+ "no-new-func": "warn",
53
+ "no-new-object": "warn",
54
+ "no-new-symbol": "warn",
55
+ "no-new-wrappers": "warn",
56
+ "no-obj-calls": "warn",
57
+ "no-octal": "warn",
58
+ "no-octal-escape": "warn",
59
+ "no-regex-spaces": "warn",
60
+ "no-restricted-syntax": ["warn", "WithStatement"],
61
+ "no-script-url": "warn",
62
+ "no-self-assign": "warn",
63
+ "no-self-compare": "warn",
64
+ "no-sequences": "warn",
65
+ "no-shadow-restricted-names": "warn",
66
+ "no-sparse-arrays": "warn",
67
+ "no-template-curly-in-string": "warn",
68
+ "no-this-before-super": "warn",
69
+ "no-throw-literal": "warn",
70
+ "no-useless-computed-key": "warn",
71
+ "no-useless-concat": "warn",
72
+ "no-useless-escape": "warn",
73
+ "no-useless-rename": [
74
+ "warn",
75
+ {
76
+ ignoreDestructuring: false,
77
+ ignoreImport: false,
78
+ ignoreExport: false,
79
+ },
80
+ ],
81
+
82
+ "no-with": "warn",
83
+ "no-whitespace-before-property": "warn",
84
+ "require-yield": "warn",
85
+ "rest-spread-spacing": ["warn", "never"],
86
+ "no-lonely-if": "warn",
87
+ "no-implicit-coercion": "warn",
88
+ },
89
+ };
package/import.js CHANGED
@@ -1,57 +1,57 @@
1
- /** @type {import('eslint').ESLint} */
2
- module.exports = {
3
- extends: ["plugin:import/recommended"],
4
- plugins: ["import", "no-relative-import-paths"],
5
- rules: {
6
- "no-relative-import-paths/no-relative-import-paths": [
7
- "warn",
8
- { allowSameFolder: true, rootDir: "src" },
9
- ],
10
-
11
- // enabled rules
12
- "import/no-anonymous-default-export": "error",
13
- "import/no-commonjs": "error",
14
- "import/no-webpack-loader-syntax": "error",
15
- "import/unambiguous": "error",
16
- "import/no-default-export": "error",
17
- "import/first": "error",
18
- "import/namespace": ["error", { allowComputed: true }],
19
- "import/no-unassigned-import": ["error", { allow: ["**/*.css"] }],
20
- "import/no-named-as-default": "error",
21
- "import/prefer-default-export": "off",
22
- "import/extensions": "error",
23
- "import/first": "error",
24
- "import/no-absolute-path": "error",
25
- "import/no-amd": "error",
26
- "import/no-cycle": "error",
27
- "import/no-deprecated": "error",
28
- "import/no-mutable-exports": "error",
29
- "import/no-named-default": "error",
30
- "import/no-nodejs-modules": "error",
31
- "import/no-restricted-paths": "error",
32
- "import/no-self-import": "error",
33
- "import/no-unresolved": ["error", { commonjs: true }],
34
- "import/no-unused-modules": "error",
35
- "import/no-useless-path-segments": "error",
36
- "import/order": [
37
- "error",
38
- {
39
- groups: [
40
- ["builtin", "external"],
41
- "type",
42
- ["parent", "sibling"],
43
- "index",
44
- ],
45
- "newlines-between": "always",
46
- },
47
- ],
48
- },
49
- settings: {
50
- "import/resolver": {
51
- node: {
52
- extensions: [".ts", ".tsx", ".js", ".jsx"],
53
- moduleDirectory: ["node_modules", "./src"],
54
- },
55
- },
56
- },
57
- };
1
+ /** @type {import('eslint').ESLint} */
2
+ module.exports = {
3
+ extends: ["plugin:import/recommended"],
4
+ plugins: ["import", "no-relative-import-paths"],
5
+ rules: {
6
+ "no-relative-import-paths/no-relative-import-paths": [
7
+ "warn",
8
+ { allowSameFolder: true, rootDir: "src" },
9
+ ],
10
+
11
+ // enabled rules
12
+ "import/no-anonymous-default-export": "error",
13
+ "import/no-commonjs": "error",
14
+ "import/no-webpack-loader-syntax": "error",
15
+ "import/unambiguous": "error",
16
+ "import/no-default-export": "error",
17
+ "import/first": "error",
18
+ "import/namespace": ["error", { allowComputed: true }],
19
+ "import/no-unassigned-import": ["error", { allow: ["**/*.css"] }],
20
+ "import/no-named-as-default": "error",
21
+ "import/prefer-default-export": "off",
22
+ "import/extensions": "error",
23
+ "import/first": "error",
24
+ "import/no-absolute-path": "error",
25
+ "import/no-amd": "error",
26
+ "import/no-cycle": "error",
27
+ "import/no-deprecated": "error",
28
+ "import/no-mutable-exports": "error",
29
+ "import/no-named-default": "error",
30
+ "import/no-nodejs-modules": "error",
31
+ "import/no-restricted-paths": "error",
32
+ "import/no-self-import": "error",
33
+ "import/no-unresolved": ["error", { commonjs: true }],
34
+ "import/no-unused-modules": "error",
35
+ "import/no-useless-path-segments": "error",
36
+ "import/order": [
37
+ "error",
38
+ {
39
+ groups: [
40
+ ["builtin", "external"],
41
+ "type",
42
+ ["parent", "sibling"],
43
+ "index",
44
+ ],
45
+ "newlines-between": "always",
46
+ },
47
+ ],
48
+ },
49
+ settings: {
50
+ "import/resolver": {
51
+ node: {
52
+ extensions: [".ts", ".tsx", ".js", ".jsx"],
53
+ moduleDirectory: ["node_modules", "./src"],
54
+ },
55
+ },
56
+ },
57
+ };
package/index.js CHANGED
@@ -1,3 +1,3 @@
1
- module.exports = {
2
- extends: ["./base", "./import", "./react", "./typescript"],
3
- };
1
+ module.exports = {
2
+ extends: ["./base", "./import", "./react", "./typescript"],
3
+ };
package/node.js CHANGED
@@ -1,21 +1,21 @@
1
- module.exports = {
2
- extends: ["eslint:recommended", "plugin:node/recommended"],
3
- parserOptions: { ecmaVersion: 2020 },
4
- rules: {
5
- "node/exports-style": ["error", "module.exports"],
6
- "node/file-extension-in-import": ["error", "always"],
7
- "node/prefer-global/buffer": ["error", "always"],
8
- "node/prefer-global/console": ["error", "always"],
9
- "node/prefer-global/process": ["error", "always"],
10
- "node/prefer-global/url-search-params": ["error", "always"],
11
- "node/prefer-global/url": ["error", "always"],
12
- "node/prefer-promises/dns": "error",
13
- "node/prefer-promises/fs": "error",
14
- "node/no-unsupported-features/es-builtins": [
15
- "error",
16
- {
17
- version: ">=18",
18
- },
19
- ],
20
- },
21
- };
1
+ module.exports = {
2
+ extends: ["eslint:recommended", "plugin:node/recommended"],
3
+ parserOptions: { ecmaVersion: 2020 },
4
+ rules: {
5
+ "node/exports-style": ["error", "module.exports"],
6
+ "node/file-extension-in-import": ["error", "always"],
7
+ "node/prefer-global/buffer": ["error", "always"],
8
+ "node/prefer-global/console": ["error", "always"],
9
+ "node/prefer-global/process": ["error", "always"],
10
+ "node/prefer-global/url-search-params": ["error", "always"],
11
+ "node/prefer-global/url": ["error", "always"],
12
+ "node/prefer-promises/dns": "error",
13
+ "node/prefer-promises/fs": "error",
14
+ "node/no-unsupported-features/es-builtins": [
15
+ "error",
16
+ {
17
+ version: ">=18",
18
+ },
19
+ ],
20
+ },
21
+ };
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "name": "@uva-glass/eslint-config",
3
- "version": "1.3.1",
4
- "engines": {
5
- "node": ">=20.8.1"
6
- },
7
- "private": false,
8
- "description": "GLASS eslint configuration",
9
- "main": "index.js",
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://gitlab.ic.uva.nl/glass/eslint.git"
13
- },
14
- "author": "",
15
- "license": "ISC",
16
- "bugs": {
17
- "url": "https://gitlab.ic.uva.nl/glass/eslint/-/issues"
18
- },
19
- "files": [
20
- "base.js",
21
- "import.js",
22
- "index.js",
23
- "node.js",
24
- "react.js",
25
- "testing-library-react.js",
26
- "typescript.js"
27
- ],
28
- "homepage": "https://gitlab.ic.uva.nl/glass/eslint",
29
- "dependencies": {
30
- "@typescript-eslint/eslint-plugin": "^8.0.1",
31
- "@typescript-eslint/parser": "^8.0.1",
32
- "eslint-import-resolver-typescript": "^3.6.1",
33
- "eslint-plugin-import": "^2.29.1",
34
- "eslint-plugin-jest": "^28.7.0",
35
- "eslint-plugin-jsx-a11y": "^6.9.0",
36
- "eslint-plugin-no-relative-import-paths": "^1.5.5",
37
- "eslint-plugin-n": "^17.10.2",
38
- "eslint-plugin-promise": "^7.0.0",
39
- "eslint-plugin-react": "^7.35.0",
40
- "eslint-plugin-react-hooks": "^4.6.2",
41
- "eslint-plugin-testing-library": "^6.2.2"
42
- },
43
- "peerDependencies": {
44
- "eslint": "^8"
45
- }
46
- }
1
+ {
2
+ "name": "@uva-glass/eslint-config",
3
+ "version": "1.3.3",
4
+ "engines": {
5
+ "node": ">=22.11.0"
6
+ },
7
+ "private": false,
8
+ "description": "GLASS eslint configuration",
9
+ "main": "index.js",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://gitlab.ic.uva.nl/glass/eslint.git"
13
+ },
14
+ "author": "",
15
+ "license": "ISC",
16
+ "bugs": {
17
+ "url": "https://gitlab.ic.uva.nl/glass/eslint/-/issues"
18
+ },
19
+ "files": [
20
+ "base.js",
21
+ "import.js",
22
+ "index.js",
23
+ "node.js",
24
+ "react.js",
25
+ "testing-library-react.js",
26
+ "typescript.js"
27
+ ],
28
+ "homepage": "https://gitlab.ic.uva.nl/glass/eslint",
29
+ "dependencies": {
30
+ "@typescript-eslint/eslint-plugin": "^8.23.0",
31
+ "@typescript-eslint/parser": "^8.23.0",
32
+ "eslint-import-resolver-typescript": "^3.7.0",
33
+ "eslint-plugin-import": "^2.31.0",
34
+ "eslint-plugin-jest": "^28.11.0",
35
+ "eslint-plugin-jsx-a11y": "^6.10.2",
36
+ "eslint-plugin-no-relative-import-paths": "^1.6.1",
37
+ "eslint-plugin-n": "^17.15.1",
38
+ "eslint-plugin-promise": "^7.2.1",
39
+ "eslint-plugin-react": "^7.37.4",
40
+ "eslint-plugin-react-hooks": "^5.1.0",
41
+ "eslint-plugin-testing-library": "^7.1.1"
42
+ },
43
+ "peerDependencies": {
44
+ "eslint": "^8"
45
+ }
46
+ }
package/react.js CHANGED
@@ -1,81 +1,81 @@
1
- module.exports = {
2
- extends: ["plugin:react/recommended", "plugin:react/jsx-runtime"],
3
- plugins: ["jsx-a11y", "react", "react-hooks"],
4
- env: { browser: true },
5
- settings: { react: { version: "detect" } },
6
- parserOptions: { ecmaVersion: 2020, sourceType: "module" },
7
- rules: {
8
- "react/display-name": "off",
9
- "react/button-has-type": "off",
10
-
11
- // jsx-a11y
12
- "jsx-a11y/alt-text": "error",
13
- "jsx-a11y/anchor-has-content": "error",
14
- "jsx-a11y/anchor-is-valid": [
15
- "error",
16
- { aspects: ["noHref", "invalidHref"] },
17
- ],
18
- "jsx-a11y/aria-activedescendant-has-tabindex": "error",
19
- "jsx-a11y/aria-props": "error",
20
- "jsx-a11y/aria-proptypes": "error",
21
- "jsx-a11y/aria-role": ["error", { ignoreNonDOM: true }],
22
- "jsx-a11y/aria-unsupported-elements": "error",
23
- "jsx-a11y/autocomplete-valid": "error",
24
- "jsx-a11y/click-events-have-key-events": "error",
25
- "jsx-a11y/heading-has-content": "error",
26
- "jsx-a11y/html-has-lang": "error",
27
- "jsx-a11y/iframe-has-title": "error",
28
- "jsx-a11y/img-redundant-alt": "error",
29
- "jsx-a11y/interactive-supports-focus": "error",
30
- "jsx-a11y/label-has-associated-control": [
31
- "error",
32
- { controlComponents: ["Input"] },
33
- ],
34
- "jsx-a11y/lang": "error",
35
- "jsx-a11y/media-has-caption": "error",
36
- "jsx-a11y/mouse-events-have-key-events": "error",
37
- "jsx-a11y/no-access-key": "error",
38
- "jsx-a11y/no-distracting-elements": "error",
39
- "jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
40
- "jsx-a11y/no-noninteractive-element-interactions": "error",
41
- "jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
42
- "jsx-a11y/no-noninteractive-tabindex": "error",
43
- "jsx-a11y/no-redundant-roles": "error",
44
- "jsx-a11y/no-static-element-interactions": "error",
45
- "jsx-a11y/role-has-required-aria-props": "error",
46
- "jsx-a11y/role-supports-aria-props": "error",
47
- "jsx-a11y/scope": "error",
48
- "jsx-a11y/tabindex-no-positive": "error",
49
-
50
- // react-hooks
51
- "react-hooks/exhaustive-deps": "error",
52
- "react-hooks/rules-of-hooks": "error",
53
-
54
- // rules
55
- "react/boolean-prop-naming": "error",
56
- "react/forbid-foreign-prop-types": ["error", { allowInPropTypes: true }],
57
- "react/jsx-closing-bracket-location": ["error", "tag-aligned"],
58
- "react/jsx-curly-spacing": "error",
59
- "react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
60
- "react/jsx-fragments": ["error", "syntax"],
61
- "react/jsx-key": "error",
62
- "react/jsx-no-comment-textnodes": "error",
63
- "react/jsx-no-duplicate-props": "error",
64
- "react/jsx-no-undef": "error",
65
- "react/jsx-no-useless-fragment": ["error", { allowExpressions: true }],
66
- "react/jsx-pascal-case": ["error", { allowAllCaps: true, ignore: [] }],
67
- "react/jsx-tag-spacing": "error",
68
- "react/jsx-uses-react": "error",
69
- "react/jsx-uses-vars": "error",
70
- "react/no-danger-with-children": "error",
71
- "react/no-deprecated": "error",
72
- "react/no-did-mount-set-state": "error",
73
- "react/no-direct-mutation-state": "error",
74
- "react/no-is-mounted": "error",
75
- "react/no-typos": "error",
76
- "react/prop-types": "error",
77
- "react/require-optimization": "error",
78
- "react/require-render-return": "error",
79
- "react/style-prop-object": "error",
80
- },
81
- };
1
+ module.exports = {
2
+ extends: ["plugin:react/recommended", "plugin:react/jsx-runtime"],
3
+ plugins: ["jsx-a11y", "react", "react-hooks"],
4
+ env: { browser: true },
5
+ settings: { react: { version: "detect" } },
6
+ parserOptions: { ecmaVersion: 2020, sourceType: "module" },
7
+ rules: {
8
+ "react/display-name": "off",
9
+ "react/button-has-type": "off",
10
+
11
+ // jsx-a11y
12
+ "jsx-a11y/alt-text": "error",
13
+ "jsx-a11y/anchor-has-content": "error",
14
+ "jsx-a11y/anchor-is-valid": [
15
+ "error",
16
+ { aspects: ["noHref", "invalidHref"] },
17
+ ],
18
+ "jsx-a11y/aria-activedescendant-has-tabindex": "error",
19
+ "jsx-a11y/aria-props": "error",
20
+ "jsx-a11y/aria-proptypes": "error",
21
+ "jsx-a11y/aria-role": ["error", { ignoreNonDOM: true }],
22
+ "jsx-a11y/aria-unsupported-elements": "error",
23
+ "jsx-a11y/autocomplete-valid": "error",
24
+ "jsx-a11y/click-events-have-key-events": "error",
25
+ "jsx-a11y/heading-has-content": "error",
26
+ "jsx-a11y/html-has-lang": "error",
27
+ "jsx-a11y/iframe-has-title": "error",
28
+ "jsx-a11y/img-redundant-alt": "error",
29
+ "jsx-a11y/interactive-supports-focus": "error",
30
+ "jsx-a11y/label-has-associated-control": [
31
+ "error",
32
+ { controlComponents: ["Input"] },
33
+ ],
34
+ "jsx-a11y/lang": "error",
35
+ "jsx-a11y/media-has-caption": "error",
36
+ "jsx-a11y/mouse-events-have-key-events": "error",
37
+ "jsx-a11y/no-access-key": "error",
38
+ "jsx-a11y/no-distracting-elements": "error",
39
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
40
+ "jsx-a11y/no-noninteractive-element-interactions": "error",
41
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
42
+ "jsx-a11y/no-noninteractive-tabindex": "error",
43
+ "jsx-a11y/no-redundant-roles": "error",
44
+ "jsx-a11y/no-static-element-interactions": "error",
45
+ "jsx-a11y/role-has-required-aria-props": "error",
46
+ "jsx-a11y/role-supports-aria-props": "error",
47
+ "jsx-a11y/scope": "error",
48
+ "jsx-a11y/tabindex-no-positive": "error",
49
+
50
+ // react-hooks
51
+ "react-hooks/exhaustive-deps": "error",
52
+ "react-hooks/rules-of-hooks": "error",
53
+
54
+ // rules
55
+ "react/boolean-prop-naming": "error",
56
+ "react/forbid-foreign-prop-types": ["error", { allowInPropTypes: true }],
57
+ "react/jsx-closing-bracket-location": ["error", "tag-aligned"],
58
+ "react/jsx-curly-spacing": "error",
59
+ "react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
60
+ "react/jsx-fragments": ["error", "syntax"],
61
+ "react/jsx-key": "error",
62
+ "react/jsx-no-comment-textnodes": "error",
63
+ "react/jsx-no-duplicate-props": "error",
64
+ "react/jsx-no-undef": "error",
65
+ "react/jsx-no-useless-fragment": ["error", { allowExpressions: true }],
66
+ "react/jsx-pascal-case": ["error", { allowAllCaps: true, ignore: [] }],
67
+ "react/jsx-tag-spacing": "error",
68
+ "react/jsx-uses-react": "error",
69
+ "react/jsx-uses-vars": "error",
70
+ "react/no-danger-with-children": "error",
71
+ "react/no-deprecated": "error",
72
+ "react/no-did-mount-set-state": "error",
73
+ "react/no-direct-mutation-state": "error",
74
+ "react/no-is-mounted": "error",
75
+ "react/no-typos": "error",
76
+ "react/prop-types": "error",
77
+ "react/require-optimization": "error",
78
+ "react/require-render-return": "error",
79
+ "react/style-prop-object": "error",
80
+ },
81
+ };
@@ -1,64 +1,64 @@
1
- module.exports = {
2
- extends: ["plugin:testing-library/react", "plugin:jest/recommended"],
3
- plugins: ["jest", "testing-library", "import", "promise"],
4
- overrides: [
5
- {
6
- files: ["**/*.test.ts", "**/*.test.tsx"],
7
- env: {
8
- "jest/globals": true,
9
- },
10
- rules: {
11
- // base overrides
12
- "max-nested-callbacks": "off",
13
- "no-constructor-return": "off",
14
- "no-undef": "off",
15
- "promise/always-return": "off",
16
- "promise/avoid-new": "off",
17
- "promise/catch-or-return": "off",
18
- "promise/no-callback-in-promise": "off",
19
-
20
- // rules
21
- "max-len": "off",
22
- "no-empty-function": "warn",
23
- "require-await": "warn",
24
- "import/no-unassigned-import": "off",
25
- "class-methods-use-this": "off",
26
-
27
- "jest/no-conditional-expect": "error",
28
- "jest/no-identical-title": "error",
29
- "jest/no-interpolation-in-snapshots": "error",
30
- "jest/no-jasmine-globals": "error",
31
- "jest/no-mocks-import": "error",
32
- "jest/valid-describe-callback": "error",
33
- "jest/valid-expect": "error",
34
- "jest/valid-expect-in-promise": "error",
35
- "jest/valid-title": "warn",
36
- "jest/no-hooks": [
37
- "error",
38
- {
39
- allow: ["beforeAll", "beforeEach", "afterAll", "afterEach"],
40
- },
41
- ],
42
-
43
- "testing-library/await-async-queries": "error",
44
- "testing-library/await-async-utils": "error",
45
- "testing-library/no-await-sync-queries": "error",
46
- "testing-library/no-container": "error",
47
- "testing-library/no-debugging-utils": "error",
48
- "testing-library/no-dom-import": ["error", "react"],
49
- "testing-library/no-node-access": "error",
50
- "testing-library/no-promise-in-fire-event": "error",
51
- "testing-library/no-render-in-lifecycle": "error",
52
- "testing-library/no-unnecessary-act": "error",
53
- "testing-library/no-wait-for-multiple-assertions": "error",
54
- "testing-library/no-wait-for-side-effects": "error",
55
- "testing-library/no-wait-for-snapshot": "error",
56
- "testing-library/prefer-find-by": "warn",
57
- "testing-library/prefer-presence-queries": "error",
58
- "testing-library/prefer-query-by-disappearance": "error",
59
- "testing-library/prefer-screen-queries": "error",
60
- "testing-library/render-result-naming-convention": "error",
61
- },
62
- },
63
- ],
64
- };
1
+ module.exports = {
2
+ extends: ["plugin:testing-library/react", "plugin:jest/recommended"],
3
+ plugins: ["jest", "testing-library", "import", "promise"],
4
+ overrides: [
5
+ {
6
+ files: ["**/*.test.ts", "**/*.test.tsx"],
7
+ env: {
8
+ "jest/globals": true,
9
+ },
10
+ rules: {
11
+ // base overrides
12
+ "max-nested-callbacks": "off",
13
+ "no-constructor-return": "off",
14
+ "no-undef": "off",
15
+ "promise/always-return": "off",
16
+ "promise/avoid-new": "off",
17
+ "promise/catch-or-return": "off",
18
+ "promise/no-callback-in-promise": "off",
19
+
20
+ // rules
21
+ "max-len": "off",
22
+ "no-empty-function": "warn",
23
+ "require-await": "warn",
24
+ "import/no-unassigned-import": "off",
25
+ "class-methods-use-this": "off",
26
+
27
+ "jest/no-conditional-expect": "error",
28
+ "jest/no-identical-title": "error",
29
+ "jest/no-interpolation-in-snapshots": "error",
30
+ "jest/no-jasmine-globals": "error",
31
+ "jest/no-mocks-import": "error",
32
+ "jest/valid-describe-callback": "error",
33
+ "jest/valid-expect": "error",
34
+ "jest/valid-expect-in-promise": "error",
35
+ "jest/valid-title": "warn",
36
+ "jest/no-hooks": [
37
+ "error",
38
+ {
39
+ allow: ["beforeAll", "beforeEach", "afterAll", "afterEach"],
40
+ },
41
+ ],
42
+
43
+ "testing-library/await-async-queries": "error",
44
+ "testing-library/await-async-utils": "error",
45
+ "testing-library/no-await-sync-queries": "error",
46
+ "testing-library/no-container": "error",
47
+ "testing-library/no-debugging-utils": "error",
48
+ "testing-library/no-dom-import": ["error", "react"],
49
+ "testing-library/no-node-access": "error",
50
+ "testing-library/no-promise-in-fire-event": "error",
51
+ "testing-library/no-render-in-lifecycle": "error",
52
+ "testing-library/no-unnecessary-act": "error",
53
+ "testing-library/no-wait-for-multiple-assertions": "error",
54
+ "testing-library/no-wait-for-side-effects": "error",
55
+ "testing-library/no-wait-for-snapshot": "error",
56
+ "testing-library/prefer-find-by": "warn",
57
+ "testing-library/prefer-presence-queries": "error",
58
+ "testing-library/prefer-query-by-disappearance": "error",
59
+ "testing-library/prefer-screen-queries": "error",
60
+ "testing-library/render-result-naming-convention": "error",
61
+ },
62
+ },
63
+ ],
64
+ };
package/typescript.js CHANGED
@@ -1,94 +1,94 @@
1
- module.exports = {
2
- parser: "@typescript-eslint/parser",
3
- overrides: [
4
- {
5
- files: ["**/*.ts", "**/*.tsx"],
6
- plugins: ["@typescript-eslint"],
7
- extends: ["plugin:@typescript-eslint/recommended"],
8
- parserOptions: {
9
- project: "./tsconfig.json",
10
- },
11
- rules: {
12
- // disabled
13
- "@typescript-eslint/typedef": "off",
14
- "@typescript-eslint/brace-style": "off",
15
- "@typescript-eslint/lines-between-class-members": "off",
16
- "@typescript-eslint/comma-dangle": "off",
17
- "@typescript-eslint/object-curly-spacing": "off",
18
- "@typescript-eslint/prefer-readonly-parameter-types": "off",
19
- "@typescript-eslint/restrict-template-expressions": "off",
20
- "@typescript-eslint/explicit-function-return-type": "off",
21
- "@typescript-eslint/no-extra-parens": "off",
22
- "@typescript-eslint/no-type-alias": "off",
23
- "@typescript-eslint/indent": "off",
24
-
25
- // requires strictNullChecks compiler option
26
- "@typescript-eslint/no-unnecessary-condition": "off",
27
- "@typescript-eslint/strict-boolean-expressions": "off",
28
- "@typescript-eslint/explicit-module-boundary-types": "off",
29
-
30
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
31
- "@typescript-eslint/consistent-type-assertions": "warn",
32
- "@typescript-eslint/no-array-constructor": "warn",
33
- "@typescript-eslint/no-redeclare": "warn",
34
- "@typescript-eslint/no-use-before-define": [
35
- "warn",
36
- {
37
- functions: false,
38
- classes: false,
39
- variables: false,
40
- typedefs: false,
41
- },
42
- ],
43
- "@typescript-eslint/no-unused-expressions": [
44
- "error",
45
- {
46
- allowShortCircuit: true,
47
- allowTernary: true,
48
- allowTaggedTemplates: true,
49
- },
50
- ],
51
- "@typescript-eslint/no-unused-vars": [
52
- "warn",
53
- {
54
- args: "none",
55
- ignoreRestSiblings: true,
56
- },
57
- ],
58
- "@typescript-eslint/no-magic-numbers": [
59
- "warn",
60
- {
61
- ignore: [0],
62
- ignoreArrayIndexes: true,
63
- ignoreEnums: true,
64
- ignoreNumericLiteralTypes: true,
65
- ignoreTypeIndexes: true,
66
- },
67
- ],
68
- "@typescript-eslint/no-useless-constructor": "warn",
69
- "@typescript-eslint/consistent-type-imports": "error",
70
- "@typescript-eslint/consistent-type-assertions": "warn",
71
- "@typescript-eslint/no-array-constructor": "warn",
72
- "@typescript-eslint/dot-notation": "warn",
73
-
74
- // disable for tests
75
- "@typescript-eslint/init-declarations": "off",
76
-
77
- // extensions (superseded by typescript rules)
78
- "init-declarations": "off",
79
- "no-use-before-define": "off",
80
- "no-useless-constructor": "off",
81
- "no-unused-vars": "off",
82
- "no-unused-expressions": "off",
83
- "no-use-before-define": "off",
84
- "no-redeclare": "off",
85
- "no-undef": "off",
86
- "no-array-constructor": "off",
87
- "no-magic-numbers": "off",
88
- "space-before-function-paren": "off",
89
- "dot-notation": "off",
90
- },
91
- },
92
- ],
93
- rules: {},
94
- };
1
+ module.exports = {
2
+ parser: "@typescript-eslint/parser",
3
+ overrides: [
4
+ {
5
+ files: ["**/*.ts", "**/*.tsx"],
6
+ plugins: ["@typescript-eslint"],
7
+ extends: ["plugin:@typescript-eslint/recommended"],
8
+ parserOptions: {
9
+ project: "./tsconfig.json",
10
+ },
11
+ rules: {
12
+ // disabled
13
+ "@typescript-eslint/typedef": "off",
14
+ "@typescript-eslint/brace-style": "off",
15
+ "@typescript-eslint/lines-between-class-members": "off",
16
+ "@typescript-eslint/comma-dangle": "off",
17
+ "@typescript-eslint/object-curly-spacing": "off",
18
+ "@typescript-eslint/prefer-readonly-parameter-types": "off",
19
+ "@typescript-eslint/restrict-template-expressions": "off",
20
+ "@typescript-eslint/explicit-function-return-type": "off",
21
+ "@typescript-eslint/no-extra-parens": "off",
22
+ "@typescript-eslint/no-type-alias": "off",
23
+ "@typescript-eslint/indent": "off",
24
+
25
+ // requires strictNullChecks compiler option
26
+ "@typescript-eslint/no-unnecessary-condition": "off",
27
+ "@typescript-eslint/strict-boolean-expressions": "off",
28
+ "@typescript-eslint/explicit-module-boundary-types": "off",
29
+
30
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
31
+ "@typescript-eslint/consistent-type-assertions": "warn",
32
+ "@typescript-eslint/no-array-constructor": "warn",
33
+ "@typescript-eslint/no-redeclare": "warn",
34
+ "@typescript-eslint/no-use-before-define": [
35
+ "warn",
36
+ {
37
+ functions: false,
38
+ classes: false,
39
+ variables: false,
40
+ typedefs: false,
41
+ },
42
+ ],
43
+ "@typescript-eslint/no-unused-expressions": [
44
+ "error",
45
+ {
46
+ allowShortCircuit: true,
47
+ allowTernary: true,
48
+ allowTaggedTemplates: true,
49
+ },
50
+ ],
51
+ "@typescript-eslint/no-unused-vars": [
52
+ "warn",
53
+ {
54
+ args: "none",
55
+ ignoreRestSiblings: true,
56
+ },
57
+ ],
58
+ "@typescript-eslint/no-magic-numbers": [
59
+ "warn",
60
+ {
61
+ ignore: [0],
62
+ ignoreArrayIndexes: true,
63
+ ignoreEnums: true,
64
+ ignoreNumericLiteralTypes: true,
65
+ ignoreTypeIndexes: true,
66
+ },
67
+ ],
68
+ "@typescript-eslint/no-useless-constructor": "warn",
69
+ "@typescript-eslint/consistent-type-imports": "error",
70
+ "@typescript-eslint/consistent-type-assertions": "warn",
71
+ "@typescript-eslint/no-array-constructor": "warn",
72
+ "@typescript-eslint/dot-notation": "warn",
73
+
74
+ // disable for tests
75
+ "@typescript-eslint/init-declarations": "off",
76
+
77
+ // extensions (superseded by typescript rules)
78
+ "init-declarations": "off",
79
+ "no-use-before-define": "off",
80
+ "no-useless-constructor": "off",
81
+ "no-unused-vars": "off",
82
+ "no-unused-expressions": "off",
83
+ "no-use-before-define": "off",
84
+ "no-redeclare": "off",
85
+ "no-undef": "off",
86
+ "no-array-constructor": "off",
87
+ "no-magic-numbers": "off",
88
+ "space-before-function-paren": "off",
89
+ "dot-notation": "off",
90
+ },
91
+ },
92
+ ],
93
+ rules: {},
94
+ };