@fullstacksjs/eslint-config 6.5.2

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/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2018 Frontendmonster
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ <div align="center">
2
+
3
+ ![logo][logo]
4
+
5
+ <br/>
6
+
7
+ ![download status][download-badge]
8
+ ![version][version-badge]
9
+ ![MIT License][license-badge]
10
+
11
+ </div>
12
+
13
+ ## Installation
14
+
15
+ If you use [ESLint](https://eslint.org/) alongside [TypeScript](https://typescriptlang.org/)
16
+ ### npm :
17
+ ```sh
18
+ $ npm install --save-dev @fullstacksjs/eslint-config eslint prettier typescript
19
+ ```
20
+ ### yarn :
21
+ ```sh
22
+ $ yarn add --dev @fullstacksjs/eslint-config eslint prettier typescript
23
+ ```
24
+ for JavaScript development
25
+ ### npm :
26
+ ```sh
27
+ $ npm install --save-dev @fullstacksjs/eslint-config eslint prettier
28
+ ```
29
+ ### yarn :
30
+ ```sh
31
+ $ yarn add --dev @fullstacksjs/eslint-config eslint prettier
32
+ ```
33
+ optional dependencies (if you need):
34
+ * react
35
+ * jest
36
+
37
+ ## Usage
38
+
39
+ Just extend from `@fullstacksjs`:
40
+
41
+ ```json
42
+ {
43
+ "extends": ["@fullstacksjs"]
44
+ }
45
+ ```
46
+
47
+ It reads your root `package.json` dependencies and includes necessary rules.
48
+
49
+ ## Advanced Usage
50
+
51
+ ```jsonc
52
+ {
53
+ "extends": [
54
+ "@fullstacksjs/eslint-config/base",
55
+ "@fullstacksjs/eslint-config/jest",
56
+ "@fullstacksjs/eslint-config/react",
57
+ "@fullstacksjs/eslint-config/typescript",
58
+ "@fullstacksjs/eslint-config/strict",
59
+ "@fullstacksjs/eslint-config/typecheck" // ⚠️ Needs configurations (not included in default config)
60
+ ]
61
+ }
62
+ ```
63
+
64
+ ## Need more typescript rules?
65
+
66
+ If you need more advanced `typescript-eslint` rules, then you can extend from `"@fullstacksjs/eslint-config/typecheck"` and set `parserOptions.project` option:
67
+
68
+ ```json
69
+ {
70
+ "extends": [
71
+ "@fullstacksjs",
72
+ "@fullstacksjs/eslint-config/typecheck"
73
+ ],
74
+ "parserOptions": {
75
+ "project": "<PATH_TO_TSCONFIG>"
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## What's included?
81
+
82
+ * @typescript-eslint/eslint-plugin
83
+ * eslint-plugin-import
84
+ * eslint-plugin-jest
85
+ * eslint-plugin-jsx-a11y
86
+ * eslint-plugin-prettier
87
+ * eslint-plugin-react
88
+ * eslint-plugin-react-hooks
89
+ * eslint-plugin-simple-import-sort
90
+ * eslint-plugin-fp
91
+ * eslint-plugin-node
92
+ * eslint-plugin-promise
93
+
94
+ That's all. Feel free to use 💛
95
+
96
+ [logo]: https://raw.githubusercontent.com/fullstacksjs/eslint-config/master/assets/logo.png
97
+ [download-badge]: https://img.shields.io/npm/dm/@fullstacksjs/eslint-config?color=6464E2&label=DOWNLOADS&style=flat-square
98
+ [version-badge]: https://img.shields.io/npm/v/@fullstacksjs/eslint-config?color=6464E2&label=VERSION&style=flat-square
99
+ [license-badge]: https://img.shields.io/npm/l/@fullstacksjs/eslint-config?color=6464E2&label=LICENSE&style=flat-square
package/base.js ADDED
@@ -0,0 +1,34 @@
1
+ module.exports = {
2
+ plugins: ['prettier', 'import', 'simple-import-sort', 'promise', 'node', 'fp'],
3
+ parserOptions: {
4
+ ecmaVersion: 2020,
5
+ sourceType: 'module',
6
+ requireConfigFile: false,
7
+ },
8
+ settings: {
9
+ 'import/resolver': {
10
+ node: {
11
+ extensions: ['.mjs', '.js', '.json', '.jsx'],
12
+ },
13
+ },
14
+ 'import/core-modules': [],
15
+ 'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
16
+ },
17
+ env: {
18
+ browser: true,
19
+ es6: true,
20
+ node: true,
21
+ },
22
+ extends: [
23
+ './rules/base',
24
+ './rules/es2015',
25
+ './rules/forbidden',
26
+ './rules/import',
27
+ './rules/style',
28
+ './rules/variables',
29
+ './rules/fp',
30
+ './rules/promise',
31
+ './rules/node',
32
+ 'prettier',
33
+ ],
34
+ };
package/index.js ADDED
@@ -0,0 +1,18 @@
1
+ const fs = require('fs');
2
+ const { Packages } = require('@frontendmonster/utils');
3
+ const readPkgUp = require('read-pkg-up');
4
+
5
+ const { packageJson: pkg } = readPkgUp.sync({
6
+ cwd: fs.realpathSync(process.cwd()),
7
+ });
8
+
9
+ const packages = Packages(pkg);
10
+
11
+ module.exports = {
12
+ extends: [
13
+ require.resolve('./base'),
14
+ packages.ifAnyDep('jest', () => require.resolve('./jest')),
15
+ packages.ifAnyDep('react', () => require.resolve('./react')),
16
+ packages.ifAnyDep('typescript', () => require.resolve('./typescript')),
17
+ ].filter(Boolean),
18
+ };
package/jest.js ADDED
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ plugins: ['jest'],
3
+ env: {
4
+ 'jest/globals': true,
5
+ },
6
+ extends: ['./rules/jest'],
7
+ };
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@fullstacksjs/eslint-config",
3
+ "version": "6.5.2",
4
+ "license": "MIT",
5
+ "author": "fullstacks <fullstacksjs@gmail.com>",
6
+ "description": "fullstacks eslint config",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/fullstacksjs/eslint-config.git"
10
+ },
11
+ "publishConfig": {
12
+ "registry": "https://registry.npmjs.org"
13
+ },
14
+ "files": [
15
+ "rules",
16
+ "base.js",
17
+ "index.js",
18
+ "jest.js",
19
+ "react.js",
20
+ "typescript.js",
21
+ "typecheck.js"
22
+ ],
23
+ "scripts": {
24
+ "lint": "eslint .",
25
+ "check-rules:base": "eslint-find-rules --unused ./base.js",
26
+ "check-rules:jest": "eslint-find-rules --no-core --unused ./tests/jest.js",
27
+ "check-rules:react": "eslint-find-rules --no-core --unused ./tests/react.js",
28
+ "check-rules:typescript": "eslint-find-rules --no-core --unused ./tests/typescript.js",
29
+ "test": "npm-run-all --parallel check-rules:*",
30
+ "prepare": "husky install",
31
+ "prepublishOnly": "pinst --disable",
32
+ "postpublish": "pinst --enable",
33
+ "pre-commit": "npm run test && lint-staged"
34
+ },
35
+ "main": "index.js",
36
+ "dependencies": {
37
+ "@frontendmonster/utils": "0.3.11",
38
+ "@typescript-eslint/eslint-plugin": "4.31.1",
39
+ "@typescript-eslint/parser": "4.31.1",
40
+ "eslint-config-prettier": "8.3.0",
41
+ "eslint-import-resolver-typescript": "2.5.0",
42
+ "eslint-plugin-fp": "2.3.0",
43
+ "eslint-plugin-import": "2.24.2",
44
+ "eslint-plugin-jest": "24.4.0",
45
+ "eslint-plugin-jsx-a11y": "6.4.1",
46
+ "eslint-plugin-node": "11.1.0",
47
+ "eslint-plugin-prettier": "4.0.0",
48
+ "eslint-plugin-promise": "5.1.0",
49
+ "eslint-plugin-react": "7.25.1",
50
+ "eslint-plugin-react-hooks": "4.2.0",
51
+ "eslint-plugin-simple-import-sort": "7.0.0",
52
+ "lodash.has": "4.5.2",
53
+ "read-pkg-up": "7.0.1"
54
+ },
55
+ "devDependencies": {
56
+ "eslint": "7.32.0",
57
+ "eslint-find-rules": "3.6.1",
58
+ "husky": "7.0.2",
59
+ "lint-staged": "11.1.2",
60
+ "np": "7.5.0",
61
+ "npm-run-all": "4.1.5",
62
+ "pinst": "2.1.6",
63
+ "prettier": "2.4.0",
64
+ "typescript": "4.4.3"
65
+ },
66
+ "peerDependencies": {
67
+ "eslint": ">=7",
68
+ "prettier": ">=1",
69
+ "react": ">=16",
70
+ "typescript": ">=4"
71
+ },
72
+ "peerDependenciesMeta": {
73
+ "typescript": {
74
+ "optional": true
75
+ },
76
+ "react": {
77
+ "optional": true
78
+ }
79
+ }
80
+ }
package/react.js ADDED
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ plugins: ['react', 'react-hooks', 'jsx-a11y'],
3
+ parserOptions: {
4
+ ecmaFeatures: {
5
+ jsx: true,
6
+ },
7
+ },
8
+ settings: {
9
+ react: {
10
+ pragma: 'React',
11
+ version: 'detect',
12
+ },
13
+ },
14
+ env: {
15
+ browser: true,
16
+ },
17
+ extends: ['./rules/react', './rules/react-hooks', './rules/jsx-a11y', 'prettier'],
18
+ };
package/rules/base.js ADDED
@@ -0,0 +1,86 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'accessor-pairs': 'error',
4
+ 'array-callback-return': 'error',
5
+ 'block-scoped-var': 'error',
6
+ 'complexity': ['error', 14],
7
+ 'consistent-return': 'off',
8
+ 'default-case': 'error',
9
+ 'dot-notation': 'error',
10
+ 'eqeqeq': ['error', 'smart'],
11
+ 'guard-for-in': 'error',
12
+ 'no-alert': 'error',
13
+ 'no-caller': 'error',
14
+ 'no-case-declarations': 'error',
15
+ 'no-div-regex': 'error',
16
+ 'no-else-return': 'off',
17
+ 'no-empty-function': 'off',
18
+ 'no-empty-pattern': 'error',
19
+ 'no-eq-null': 'off',
20
+ 'no-eval': 'error',
21
+ 'no-extend-native': 'error',
22
+ 'no-extra-bind': 'error',
23
+ 'no-extra-label': 'error',
24
+ 'no-fallthrough': 'error',
25
+ 'no-floating-decimal': 'error',
26
+ 'no-global-assign': 'error',
27
+ 'no-implicit-coercion': 'off',
28
+ 'no-implicit-globals': 'error',
29
+ 'no-implied-eval': 'error',
30
+ 'no-invalid-this': 'warn',
31
+ 'no-iterator': 'error',
32
+ 'no-labels': 'error',
33
+ 'no-lone-blocks': 'error',
34
+ 'no-loop-func': 'error',
35
+ 'no-loss-of-precision': 'warn',
36
+ 'no-magic-numbers': 'off',
37
+ 'no-multi-str': 'error',
38
+ 'no-new-func': 'error',
39
+ 'no-new-wrappers': 'error',
40
+ 'no-new': 'error',
41
+ 'no-octal-escape': 'error',
42
+ 'no-octal': 'error',
43
+ 'no-param-reassign': 'off',
44
+ 'no-proto': 'error',
45
+ 'no-redeclare': 'error',
46
+ 'no-restricted-properties': 'off',
47
+ 'no-restricted-exports': 'off',
48
+ 'no-restricted-syntax': ['error', 'WithStatement'],
49
+ 'no-return-assign': 'error',
50
+ 'no-script-url': 'error',
51
+ 'no-self-assign': 'error',
52
+ 'no-self-compare': 'error',
53
+ 'no-sequences': 'error',
54
+ 'no-throw-literal': 'error',
55
+ 'no-unmodified-loop-condition': 'error',
56
+ 'no-unsafe-optional-chaining': 'error',
57
+ 'no-unused-expressions': 'off',
58
+ 'no-unused-labels': 'error',
59
+ 'no-useless-call': 'error',
60
+ 'no-useless-catch': 'error',
61
+ 'no-useless-concat': 'error',
62
+ 'no-useless-escape': 'error',
63
+ 'no-useless-return': 'error',
64
+ 'no-void': 'off',
65
+ 'no-warning-comments': ['warn', { terms: ['fixme'], location: 'anywhere' }],
66
+ 'no-with': 'off',
67
+ 'prefer-promise-reject-errors': 'off',
68
+ 'prefer-named-capture-group': 'off',
69
+ 'radix': 'error',
70
+ 'require-await': 'error',
71
+ 'vars-on-top': 'error',
72
+ 'yoda': 'error',
73
+ 'require-atomic-updates': 'off',
74
+ 'require-unicode-regexp': 'off',
75
+ 'no-misleading-character-class': 'off',
76
+ 'no-async-promise-executor': 'off',
77
+ 'no-console': 'off',
78
+ 'no-constructor-return': 'error',
79
+ 'no-dupe-else-if': 'error',
80
+ 'no-import-assign': 'error',
81
+ 'no-setter-return': 'error',
82
+ 'prefer-regex-literals': 'off',
83
+ 'grouped-accessor-pairs': 'off',
84
+ 'strict': 'error',
85
+ },
86
+ };
@@ -0,0 +1,28 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'class-methods-use-this': 'off',
4
+ 'no-class-assign': 'error',
5
+ 'no-duplicate-imports': 'off', // Handled by import plugin
6
+ 'no-restricted-imports': 'off',
7
+ 'no-return-await': 'error',
8
+ 'no-useless-computed-key': 'error',
9
+ 'no-useless-constructor': 'error',
10
+ 'no-useless-rename': 'error',
11
+ 'no-var': 'warn',
12
+ 'prefer-const': 'warn',
13
+ 'prefer-exponentiation-operator': 'warn',
14
+ 'prefer-numeric-literals': 'error',
15
+ 'prefer-rest-params': 'error',
16
+ 'prefer-spread': 'error',
17
+ 'prefer-template': 'error',
18
+ 'require-yield': 'error',
19
+ 'symbol-description': 'error',
20
+ 'constructor-super': 'error',
21
+ 'no-await-in-loop': 'error',
22
+ 'no-const-assign': 'error',
23
+ 'no-dupe-class-members': 'error',
24
+ 'no-new-symbol': 'error',
25
+ 'no-this-before-super': 'error',
26
+ 'no-unused-expressions': 'off',
27
+ },
28
+ };
@@ -0,0 +1,37 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'default-case-last': 'error',
4
+ 'for-direction': 'error',
5
+ 'getter-return': ['error', { allowImplicit: true }],
6
+ 'no-compare-neg-zero': 'error',
7
+ 'no-cond-assign': 'error',
8
+ 'no-constant-condition': 'error',
9
+ 'no-control-regex': 'error',
10
+ 'no-debugger': 'error',
11
+ 'no-dupe-args': 'error',
12
+ 'no-dupe-keys': 'error',
13
+ 'no-duplicate-case': 'error',
14
+ 'no-empty-character-class': 'error',
15
+ 'no-empty': 'error',
16
+ 'no-ex-assign': 'error',
17
+ 'no-extra-boolean-cast': 'off',
18
+ 'no-func-assign': 'error',
19
+ 'no-inner-declarations': 'error',
20
+ 'no-invalid-regexp': 'error',
21
+ 'no-irregular-whitespace': 'error',
22
+ 'no-nonoctal-decimal-escape': 'error',
23
+ 'no-obj-calls': 'error',
24
+ 'no-prototype-builtins': 'off',
25
+ 'no-regex-spaces': 'error',
26
+ 'no-sparse-arrays': 'error',
27
+ 'no-template-curly-in-string': 'off', // Some libs need curly in string for internal templates.
28
+ 'no-unexpected-multiline': 'error',
29
+ 'no-unreachable-loop': 'error',
30
+ 'no-unreachable': 'error',
31
+ 'no-unsafe-finally': 'error',
32
+ 'no-unsafe-negation': 'error',
33
+ 'no-useless-backreference': 'error',
34
+ 'use-isnan': 'error',
35
+ 'valid-typeof': 'error',
36
+ },
37
+ };
package/rules/fp.js ADDED
@@ -0,0 +1,21 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'fp/no-arguments': 'error',
4
+ 'fp/no-class': 'off',
5
+ 'fp/no-delete': 'off',
6
+ 'fp/no-events': 'off',
7
+ 'fp/no-get-set': 'off',
8
+ 'fp/no-let': 'error',
9
+ 'fp/no-loops': 'error',
10
+ 'fp/no-mutating-assign': 'error',
11
+ 'fp/no-mutating-methods': 'off',
12
+ 'fp/no-mutation': 'off',
13
+ 'fp/no-nil': 'off',
14
+ 'fp/no-proxy': 'off',
15
+ 'fp/no-rest-parameters': 'off',
16
+ 'fp/no-this': 'off',
17
+ 'fp/no-throw': 'off',
18
+ 'fp/no-unused-expression': 'off',
19
+ 'fp/no-valueof-field': 'off',
20
+ },
21
+ };
@@ -0,0 +1,49 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'import/default': 'error',
4
+ 'import/dynamic-import-chunkname': 'off',
5
+ 'import/export': 'error',
6
+ 'import/exports-last': 'off',
7
+ 'import/extensions': ['error', 'always', { js: 'never', jsx: 'never', ts: 'never', tsx: 'never' }],
8
+ 'import/first': 'error',
9
+ 'import/group-exports': 'off',
10
+ 'import/max-dependencies': ['off', { ignoreTypeImports: true }],
11
+ 'import/named': 'error',
12
+ 'import/namespace': 'error',
13
+ 'import/newline-after-import': 'warn',
14
+ 'import/no-absolute-path': 'error',
15
+ 'import/no-amd': 'error',
16
+ 'import/no-anonymous-default-export': 'off',
17
+ 'import/no-commonjs': 'off',
18
+ 'import/no-cycle': ['error', { maxDepth: Infinity }],
19
+ 'import/no-relative-packages': 'error',
20
+ 'import/no-import-module-exports': 'off',
21
+ 'import/no-default-export': 'off',
22
+ 'import/no-deprecated': 'warn',
23
+ 'import/no-duplicates': 'error',
24
+ 'import/no-dynamic-require': 'off',
25
+ 'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
26
+ 'import/no-internal-modules': 'off',
27
+ 'import/no-mutable-exports': 'error',
28
+ 'import/no-named-as-default-member': 'error',
29
+ 'import/no-named-as-default': 'error',
30
+ 'import/no-named-default': 'error',
31
+ 'import/no-named-export': 'off',
32
+ 'import/no-namespace': 'off',
33
+ 'import/no-nodejs-modules': 'off',
34
+ 'import/no-relative-parent-imports': 'off',
35
+ 'import/no-restricted-paths': 'off',
36
+ 'import/no-self-import': 'error',
37
+ 'import/no-unassigned-import': 'off',
38
+ 'import/no-unresolved': 'error',
39
+ 'import/no-unused-modules': 'off',
40
+ 'import/no-useless-path-segments': 'off',
41
+ 'import/no-webpack-loader-syntax': 'error',
42
+ 'import/order': ['off', { groups: ['builtin', ['external', 'internal'], 'parent', ['sibling', 'index']] }], // collision
43
+ 'import/prefer-default-export': 'off',
44
+ 'import/unambiguous': 'off',
45
+ 'simple-import-sort/exports': 'warn',
46
+ 'simple-import-sort/imports': 'warn',
47
+ 'sort-imports': 'off',
48
+ },
49
+ };
package/rules/jest.js ADDED
@@ -0,0 +1,56 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'jest/consistent-test-it': 'off',
4
+ 'jest/expect-expect': 'off',
5
+ 'jest/lowercase-name': 'off',
6
+ 'jest/max-nested-describe': ['error', { max: 2 }],
7
+ 'jest/no-alias-methods': 'off',
8
+ 'jest/no-commented-out-tests': 'warn',
9
+ 'jest/no-conditional-expect': 'error',
10
+ 'jest/no-deprecated-functions': 'error',
11
+ 'jest/no-disabled-tests': 'warn',
12
+ 'jest/no-done-callback': 'warn',
13
+ 'jest/no-duplicate-hooks': 'off',
14
+ 'jest/no-expect-resolves': 'off',
15
+ 'jest/no-export': 'error',
16
+ 'jest/no-focused-tests': 'error',
17
+ 'jest/no-hooks': 'off',
18
+ 'jest/no-identical-title': 'error',
19
+ 'jest/no-if': 'error',
20
+ 'jest/no-interpolation-in-snapshots': 'error',
21
+ 'jest/no-jasmine-globals': 'off',
22
+ 'jest/no-jest-import': 'error',
23
+ 'jest/no-large-snapshots': ['warn', { maxSize: 300 }],
24
+ 'jest/no-mocks-import': 'error',
25
+ 'jest/no-restricted-matchers': 'error',
26
+ 'jest/no-standalone-expect': 'off',
27
+ 'jest/no-test-callback': 'off',
28
+ 'jest/no-test-prefixes': 'error',
29
+ 'jest/no-test-return-statement': 'off',
30
+ 'jest/no-truthy-falsy': 'off',
31
+ 'jest/prefer-called-with': 'error',
32
+ 'jest/prefer-expect-assertions': 'off',
33
+ 'jest/prefer-hooks-on-top': 'error',
34
+ 'jest/prefer-inline-snapshots': 'off',
35
+ 'jest/prefer-spy-on': 'off',
36
+ 'jest/prefer-strict-equal': 'off',
37
+ 'jest/prefer-to-be-null': 'off',
38
+ 'jest/prefer-to-be-undefined': 'off',
39
+ 'jest/prefer-to-contain': 'warn',
40
+ 'jest/prefer-to-have-length': 'warn',
41
+ 'jest/prefer-todo': 'warn',
42
+ 'jest/require-to-throw-message': 'off',
43
+ 'jest/require-top-level-describe': 'off',
44
+ 'jest/unbound-method': 'error',
45
+ 'jest/valid-describe': 'error',
46
+ 'jest/valid-expect-in-promise': 'error',
47
+ 'jest/valid-expect': 'error',
48
+ 'jest/valid-title': 'warn',
49
+
50
+ // conflicts
51
+ '@typescript-eslint/unbound-method': 'off',
52
+ },
53
+ env: {
54
+ 'jest/globals': true,
55
+ },
56
+ };
@@ -0,0 +1,38 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'jsx-a11y/alt-text': 'warn',
4
+ 'jsx-a11y/anchor-has-content': 'error',
5
+ 'jsx-a11y/anchor-is-valid': 'error',
6
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
7
+ 'jsx-a11y/aria-props': 'error',
8
+ 'jsx-a11y/aria-proptypes': 'error',
9
+ 'jsx-a11y/aria-role': 'error',
10
+ 'jsx-a11y/aria-unsupported-elements': 'error',
11
+ 'jsx-a11y/autocomplete-valid': 'off',
12
+ 'jsx-a11y/click-events-have-key-events': 'error',
13
+ 'jsx-a11y/heading-has-content': 'error',
14
+ 'jsx-a11y/html-has-lang': 'error',
15
+ 'jsx-a11y/iframe-has-title': 'error',
16
+ 'jsx-a11y/img-redundant-alt': 'error',
17
+ 'jsx-a11y/interactive-supports-focus': 'warn',
18
+ 'jsx-a11y/lang': 'error',
19
+ 'jsx-a11y/media-has-caption': 'warn',
20
+ 'jsx-a11y/mouse-events-have-key-events': 'error',
21
+ 'jsx-a11y/no-access-key': 'error',
22
+ 'jsx-a11y/no-autofocus': 'off',
23
+ 'jsx-a11y/no-distracting-elements': 'error',
24
+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': 'warn',
25
+ 'jsx-a11y/no-noninteractive-element-interactions': 'warn',
26
+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': 'warn',
27
+ 'jsx-a11y/no-noninteractive-tabindex': 'off',
28
+ 'jsx-a11y/no-onchange': 'off',
29
+ 'jsx-a11y/no-redundant-roles': 'error',
30
+ 'jsx-a11y/no-static-element-interactions': 'off',
31
+ 'jsx-a11y/role-has-required-aria-props': 'error',
32
+ 'jsx-a11y/role-supports-aria-props': 'error',
33
+ 'jsx-a11y/scope': 'error',
34
+ 'jsx-a11y/tabindex-no-positive': 'warn',
35
+ 'jsx-a11y/label-has-associated-control': 'error',
36
+ 'jsx-a11y/control-has-associated-label': 'off',
37
+ },
38
+ };
package/rules/node.js ADDED
@@ -0,0 +1,41 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'node/no-unsupported-features/es-builtins': 'off', // Nice but not a general rule
4
+ 'node/no-unsupported-features/es-syntax': 'off', // Nice but not a general rule
5
+ 'node/no-unsupported-features/node-builtins': 'off', // Nice but not a general rule
6
+ 'node/prefer-global/buffer': 'warn',
7
+ 'node/prefer-global/console': 'warn',
8
+ 'node/prefer-global/process': 'warn',
9
+ 'node/prefer-global/text-decoder': 'warn',
10
+ 'node/prefer-global/text-encoder': 'warn',
11
+ 'node/prefer-global/url-search-params': 'warn',
12
+ 'node/prefer-global/url': 'warn',
13
+ 'node/prefer-promises/dns': 'warn',
14
+ 'node/prefer-promises/fs': 'warn',
15
+ 'node/callback-return': 'off',
16
+ 'node/exports-style': ['error', 'module.exports', { allowBatchAssign: false }],
17
+ 'node/file-extension-in-import': 'off', // import plugin
18
+ 'node/global-require': 'error',
19
+ 'node/handle-callback-err': 'warn',
20
+ 'node/no-callback-literal': 'off',
21
+ 'node/no-deprecated-api': 'error',
22
+ 'node/no-exports-assign': 'error',
23
+ 'node/no-extraneous-import': 'off', // import plugin
24
+ 'node/no-extraneous-require': 'off', // import plugin
25
+ 'node/no-missing-import': 'off', // import plugin
26
+ 'node/no-missing-require': 'off', // import plugin
27
+ 'node/no-mixed-requires': 'warn',
28
+ 'node/no-new-require': 'error',
29
+ 'node/no-path-concat': 'off',
30
+ 'node/no-process-env': 'off',
31
+ 'node/no-process-exit': 'off',
32
+ 'node/no-restricted-import': 'off',
33
+ 'node/no-restricted-require': 'off',
34
+ 'node/no-sync': 'off',
35
+ 'node/no-unpublished-bin': 'off',
36
+ 'node/no-unpublished-import': 'off',
37
+ 'node/no-unpublished-require': 'off',
38
+ 'node/process-exit-as-throw': 'off',
39
+ 'node/shebang': 'off',
40
+ },
41
+ };
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'promise/always-return': 'off',
4
+ 'promise/avoid-new': 'off',
5
+ 'promise/catch-or-return': 'off',
6
+ 'promise/no-callback-in-promise': 'off',
7
+ 'promise/no-native': 'off',
8
+ 'promise/no-nesting': 'off',
9
+ 'promise/no-new-statics': 'error',
10
+ 'promise/no-promise-in-callback': 'error',
11
+ 'promise/no-return-in-finally': 'warn',
12
+ 'promise/no-return-wrap': 'error',
13
+ 'promise/param-names': 'warn',
14
+ 'promise/prefer-await-to-callbacks': 'off',
15
+ 'promise/prefer-await-to-then': 'off',
16
+ 'promise/valid-params': 'warn',
17
+ },
18
+ };
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'react-hooks/exhaustive-deps': 'warn',
4
+ 'react-hooks/rules-of-hooks': 'error',
5
+ },
6
+ };
package/rules/react.js ADDED
@@ -0,0 +1,83 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'react/boolean-prop-naming': 'off',
4
+ 'react/button-has-type': 'off',
5
+ 'react/default-props-match-prop-types': 'off',
6
+ 'react/destructuring-assignment': 'off',
7
+ 'react/display-name': ['off', { ignoreTranspilerName: false }],
8
+ 'react/forbid-component-props': 'off',
9
+ 'react/forbid-dom-props': 'off',
10
+ 'react/forbid-elements': 'off',
11
+ 'react/forbid-foreign-prop-types': 'error',
12
+ 'react/forbid-prop-types': 'off',
13
+ 'react/function-component-definition': 'off',
14
+ 'react/jsx-boolean-value': 'off',
15
+ 'react/jsx-child-element-spacing': 'warn',
16
+ 'react/jsx-curly-brace-presence': ['warn', { props: 'never', children: 'ignore' }],
17
+ 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
18
+ 'react/jsx-fragments': 'off',
19
+ 'react/jsx-handler-names': 'off',
20
+ 'react/jsx-key': 'error',
21
+ 'react/jsx-max-depth': 'off',
22
+ 'react/jsx-newline': 'off',
23
+ 'react/jsx-no-bind': 'off',
24
+ 'react/jsx-no-comment-textnodes': 'error',
25
+ 'react/jsx-no-constructed-context-values': 'error',
26
+ 'react/jsx-no-duplicate-props': 'error',
27
+ 'react/jsx-no-literals': 'off',
28
+ 'react/jsx-no-script-url': 'error',
29
+ 'react/jsx-no-target-blank': 'error',
30
+ 'react/jsx-no-undef': 'error',
31
+ 'react/jsx-no-useless-fragment': 'warn',
32
+ 'react/jsx-one-expression-per-line': ['off', { allow: 'literal' }],
33
+ 'react/jsx-pascal-case': 'error',
34
+ 'react/jsx-props-no-multi-spaces': 'off',
35
+ 'react/jsx-props-no-spreading': 'off',
36
+ 'react/jsx-sort-default-props': 'off',
37
+ 'react/jsx-sort-props': 'off',
38
+ 'react/jsx-uses-react': 'error',
39
+ 'react/jsx-uses-vars': 'error',
40
+ 'react/no-access-state-in-setstate': 'error',
41
+ 'react/no-adjacent-inline-elements': 'error',
42
+ 'react/no-array-index-key': 'warn',
43
+ 'react/no-children-prop': 'off',
44
+ 'react/no-danger-with-children': 'error',
45
+ 'react/no-danger': 'off',
46
+ 'react/no-deprecated': 'error',
47
+ 'react/no-did-mount-set-state': 'error',
48
+ 'react/no-did-update-set-state': 'error',
49
+ 'react/no-direct-mutation-state': 'error',
50
+ 'react/no-find-dom-node': 'error',
51
+ 'react/no-is-mounted': 'error',
52
+ 'react/no-multi-comp': 'off',
53
+ 'react/no-redundant-should-component-update': 'error',
54
+ 'react/no-render-return-value': 'error',
55
+ 'react/no-set-state': 'off',
56
+ 'react/no-string-refs': 'error',
57
+ 'react/no-this-in-sfc': 'error',
58
+ 'react/no-typos': 'error',
59
+ 'react/no-unescaped-entities': 'warn',
60
+ 'react/no-unknown-property': 'error',
61
+ 'react/no-unsafe': 'warn',
62
+ 'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
63
+ 'react/no-unused-prop-types': 'error',
64
+ 'react/no-unused-state': 'error',
65
+ 'react/no-will-update-set-state': 'error',
66
+ 'react/prefer-es6-class': 'off',
67
+ 'react/prefer-read-only-props': 'off',
68
+ 'react/prefer-stateless-function': 'off',
69
+ 'react/prop-types': 'off',
70
+ 'react/prefer-exact-props': 'off',
71
+ 'react/react-in-jsx-scope': 'off', // jsx automatic runtime
72
+ 'react/require-default-props': 'off',
73
+ 'react/require-optimization': 'off',
74
+ 'react/require-render-return': 'error',
75
+ 'react/self-closing-comp': 'error',
76
+ 'react/sort-comp': 'off',
77
+ 'react/sort-prop-types': 'off',
78
+ 'react/state-in-constructor': 'off',
79
+ 'react/static-property-placement': 'off',
80
+ 'react/style-prop-object': 'error',
81
+ 'react/void-dom-elements-no-children': 'error',
82
+ },
83
+ };
@@ -0,0 +1,61 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'no-console': 'warn',
4
+ 'fp/no-delete': 'error',
5
+ 'fp/no-get-set': 'error',
6
+ 'fp/no-mutating-methods': 'error',
7
+ 'fp/no-mutation': ['error', { commonjs: true, allowThis: true, exceptions: [{ property: 'propTypes' }, { property: 'defaultProps' }] }],
8
+ 'fp/no-nil': 'error',
9
+ 'fp/no-this': 'error',
10
+ 'fp/no-throw': 'error',
11
+ 'fp/no-unused-expression': ['error', { allowUseStrict: true }],
12
+ '@typescript-eslint/naming-convention': [
13
+ 'warn',
14
+ {
15
+ selector: 'default',
16
+ format: ['camelCase'],
17
+ },
18
+ // variables, CONSTANTS, ReactComponents
19
+ {
20
+ selector: 'variable',
21
+ format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
22
+ },
23
+ {
24
+ selector: 'parameter',
25
+ format: ['camelCase'],
26
+ leadingUnderscore: 'allow',
27
+ },
28
+ {
29
+ selector: 'memberLike',
30
+ format: ['camelCase', 'PascalCase'],
31
+ leadingUnderscore: 'allow',
32
+ },
33
+ {
34
+ selector: 'memberLike',
35
+ modifiers: ['static'],
36
+ format: ['camelCase', 'PascalCase'],
37
+ leadingUnderscore: 'allow',
38
+ },
39
+ {
40
+ selector: 'memberLike',
41
+ modifiers: ['private'],
42
+ format: ['camelCase'],
43
+ leadingUnderscore: 'allow',
44
+ },
45
+ {
46
+ selector: 'typeLike',
47
+ format: ['PascalCase'],
48
+ },
49
+ {
50
+ selector: 'enumMember',
51
+ format: ['PascalCase'],
52
+ },
53
+ // disallow I prefix for interfaces
54
+ {
55
+ selector: 'interface',
56
+ format: ['PascalCase'],
57
+ custom: { regex: '^I[A-Z]', match: false },
58
+ },
59
+ ],
60
+ },
61
+ };
package/rules/style.js ADDED
@@ -0,0 +1,60 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'arrow-body-style': ['off', 'as-needed'], // Annoying
4
+ 'brace-style': 'off', // prettier
5
+ 'camelcase': ['warn', { properties: 'always' }],
6
+ 'capitalized-comments': 'off',
7
+ 'comma-spacing': ['warn', { after: true, before: false }],
8
+ 'consistent-this': 'off',
9
+ 'func-name-matching': 'error',
10
+ 'func-names': 'error',
11
+ 'func-style': 'off',
12
+ 'id-denylist': 'off',
13
+ 'init-declarations': 'off',
14
+ 'id-length': 'off',
15
+ 'id-match': [
16
+ 'error',
17
+ // __filename, camelCase, PascalCase, CONST_VALUE, stream$, $el
18
+ '^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$',
19
+ ],
20
+ 'linebreak-style': ['error', 'unix'],
21
+ 'line-comment-position': 'off',
22
+ 'lines-around-comment': 'off',
23
+ 'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: false }],
24
+ 'max-classes-per-file': 'off',
25
+ 'max-depth': ['error', 4],
26
+ 'max-lines': ['error', { max: 2500, skipBlankLines: false, skipComments: false }],
27
+ 'max-lines-per-function': ['error', 150],
28
+ 'max-nested-callbacks': ['error', 7],
29
+ 'max-params': ['error', 7],
30
+ 'max-statements-per-line': ['error', { max: 1 }],
31
+ 'max-statements': ['error', 40],
32
+ 'multiline-comment-style': 'off',
33
+ 'new-cap': 'off',
34
+ 'no-array-constructor': 'error',
35
+ 'no-bitwise': 'error',
36
+ 'no-continue': 'off',
37
+ 'no-inline-comments': 'off',
38
+ 'no-lonely-if': 'error',
39
+ 'no-multi-assign': 'error',
40
+ 'no-negated-condition': 'off',
41
+ 'no-nested-ternary': 'off',
42
+ 'no-new-object': 'error',
43
+ 'no-plusplus': 'off',
44
+ 'no-promise-executor-return': 'error',
45
+ 'no-ternary': 'off',
46
+ 'no-underscore-dangle': 'off',
47
+ 'no-unneeded-ternary': 'error',
48
+ 'object-shorthand': ['error', 'properties'],
49
+ 'one-var': ['error', { uninitialized: 'never', initialized: 'never' }],
50
+ 'operator-assignment': 'off',
51
+ 'padding-line-between-statements': 'off',
52
+ 'prefer-arrow-callback': ['warn', { allowNamedFunctions: true, allowUnboundThis: true }],
53
+ 'prefer-destructuring': 'off',
54
+ 'prefer-object-spread': 'warn',
55
+ 'sort-keys': 'off',
56
+ 'sort-vars': 'off',
57
+ 'spaced-comment': ['warn', 'always', { markers: ['/'] }], // ignore typescript triple-slash
58
+ 'prettier/prettier': 'error',
59
+ },
60
+ };
@@ -0,0 +1,73 @@
1
+ module.exports = {
2
+ rules: {
3
+ '@typescript-eslint/await-thenable': 'error',
4
+ '@typescript-eslint/dot-notation': 'warn',
5
+ '@typescript-eslint/no-meaningless-void-operator': ['warn', { checkNever: false }],
6
+ '@typescript-eslint/no-confusing-void-expression': ['warn', { ignoreArrowShorthand: true, ignoreVoidOperator: true }],
7
+ '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
8
+ '@typescript-eslint/no-implied-eval': 'error',
9
+ '@typescript-eslint/no-misused-promises': 'error',
10
+ '@typescript-eslint/no-throw-literal': 'error',
11
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
12
+ '@typescript-eslint/no-unnecessary-qualifier': 'error',
13
+ '@typescript-eslint/no-unnecessary-type-arguments': 'error',
14
+ '@typescript-eslint/no-unnecessary-type-assertion': 'error',
15
+ '@typescript-eslint/non-nullable-type-assertion-style': 'warn',
16
+ '@typescript-eslint/prefer-includes': 'warn',
17
+ '@typescript-eslint/prefer-reduce-type-parameter': 'warn',
18
+ '@typescript-eslint/prefer-regexp-exec': 'warn',
19
+ '@typescript-eslint/prefer-return-this-type': 'warn',
20
+ '@typescript-eslint/prefer-string-starts-ends-with': 'warn',
21
+ '@typescript-eslint/require-array-sort-compare': 'error',
22
+ '@typescript-eslint/require-await': 'error',
23
+ '@typescript-eslint/return-await': 'error',
24
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
25
+ '@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
26
+ '@typescript-eslint/naming-convention': [
27
+ 'warn',
28
+ {
29
+ selector: 'default',
30
+ format: ['camelCase'],
31
+ },
32
+ // variables, CONSTANTS, ReactComponents
33
+ {
34
+ selector: 'variable',
35
+ format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
36
+ },
37
+ {
38
+ selector: 'parameter',
39
+ format: ['camelCase'],
40
+ leadingUnderscore: 'allow',
41
+ },
42
+ {
43
+ selector: 'memberLike',
44
+ modifiers: ['private'],
45
+ format: ['camelCase'],
46
+ leadingUnderscore: 'allow',
47
+ },
48
+ {
49
+ selector: 'typeLike',
50
+ format: ['PascalCase'],
51
+ },
52
+ // disallow I prefix for interfaces
53
+ {
54
+ selector: 'interface',
55
+ format: ['PascalCase'],
56
+ custom: {
57
+ regex: '^I[A-Z]',
58
+ match: false,
59
+ },
60
+ },
61
+ // force use is/should/has ... for boolean variables
62
+ {
63
+ selector: 'variable',
64
+ types: ['boolean'],
65
+ format: ['camelCase'],
66
+ prefix: ['is', 'should', 'has', 'can', 'did', 'will', 'enable'],
67
+ },
68
+ ],
69
+
70
+ // collisions
71
+ 'dot-notation': 'off',
72
+ },
73
+ };
@@ -0,0 +1,147 @@
1
+ module.exports = {
2
+ rules: {
3
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
4
+ '@typescript-eslint/array-type': 'error',
5
+ '@typescript-eslint/ban-ts-comment': [
6
+ 'error',
7
+ {
8
+ 'ts-expect-error': 'allow-with-description',
9
+ 'ts-ignore': 'allow-with-description',
10
+ 'ts-nocheck': 'allow-with-description',
11
+ 'ts-check': 'allow-with-description',
12
+ 'minimumDescriptionLength': 3,
13
+ },
14
+ ],
15
+ '@typescript-eslint/ban-tslint-comment': 'off',
16
+ '@typescript-eslint/ban-types': 'error',
17
+ '@typescript-eslint/camelcase': 'off',
18
+ '@typescript-eslint/class-literal-property-style': ['error', 'getters'],
19
+ '@typescript-eslint/consistent-indexed-object-style': 'off',
20
+ '@typescript-eslint/consistent-type-assertions': 'error',
21
+ '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
22
+ '@typescript-eslint/consistent-type-imports': 'off',
23
+ '@typescript-eslint/default-param-last': 'warn',
24
+ '@typescript-eslint/explicit-function-return-type': 'off',
25
+ '@typescript-eslint/explicit-member-accessibility': 'off',
26
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
27
+ '@typescript-eslint/generic-type-naming': 'off',
28
+ '@typescript-eslint/init-declarations': ['off'],
29
+ '@typescript-eslint/lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
30
+ '@typescript-eslint/member-naming': 'off',
31
+ '@typescript-eslint/member-ordering': 'off',
32
+ '@typescript-eslint/method-signature-style': ['warn', 'property'],
33
+ '@typescript-eslint/no-array-constructor': 'error',
34
+ '@typescript-eslint/no-base-to-string': 'off', // false negative
35
+ '@typescript-eslint/no-confusing-non-null-assertion': 'error',
36
+ '@typescript-eslint/no-dupe-class-members': 'error',
37
+ '@typescript-eslint/no-duplicate-imports': ['error'],
38
+ '@typescript-eslint/no-dynamic-delete': 'error',
39
+ '@typescript-eslint/no-empty-function': 'error',
40
+ '@typescript-eslint/no-empty-interface': 'off', // Annoying with auto-fix on save.
41
+ '@typescript-eslint/no-explicit-any': 'off',
42
+ '@typescript-eslint/no-extra-non-null-assertion': 'error',
43
+ '@typescript-eslint/no-extraneous-class': 'error',
44
+ '@typescript-eslint/no-for-in-array': 'error',
45
+ '@typescript-eslint/no-implicit-any-catch': 'off',
46
+ '@typescript-eslint/no-inferrable-types': 'off',
47
+ '@typescript-eslint/no-invalid-this': ['error', { capIsConstructor: false }],
48
+ '@typescript-eslint/no-invalid-void-type': 'error',
49
+ '@typescript-eslint/no-loop-func': 'error',
50
+ '@typescript-eslint/no-loss-of-precision': 'error',
51
+ '@typescript-eslint/no-magic-numbers': ['off', { ignoreEnums: true }], // Not good enough yet
52
+ '@typescript-eslint/no-misused-new': 'error',
53
+ '@typescript-eslint/no-namespace': 'error',
54
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
55
+ '@typescript-eslint/no-non-null-assertion': 'warn',
56
+ '@typescript-eslint/no-parameter-properties': 'off',
57
+ '@typescript-eslint/no-redeclare': ['off', { ignoreDeclarationMerge: true }], // useful in FP.
58
+ '@typescript-eslint/no-require-imports': 'error',
59
+ '@typescript-eslint/no-shadow': 'error',
60
+ '@typescript-eslint/no-this-alias': 'error',
61
+ '@typescript-eslint/no-type-alias': 'off',
62
+ '@typescript-eslint/no-unnecessary-condition': 'off',
63
+ '@typescript-eslint/no-unnecessary-type-constraint': 'warn',
64
+ '@typescript-eslint/no-unsafe-assignment': 'off',
65
+ '@typescript-eslint/no-unsafe-argument': 'off',
66
+ '@typescript-eslint/no-unsafe-call': 'off',
67
+ '@typescript-eslint/no-unsafe-member-access': 'off',
68
+ '@typescript-eslint/no-unsafe-return': 'off',
69
+ '@typescript-eslint/no-untyped-public-signature': 'off',
70
+ '@typescript-eslint/no-unused-expressions': 'error',
71
+ '@typescript-eslint/no-unused-vars-experimental': 'off', // Why two rules?
72
+ '@typescript-eslint/no-unused-vars': [
73
+ 'warn',
74
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^[iI]gnore(d)?', args: 'after-used', ignoreRestSiblings: true },
75
+ ],
76
+ '@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: true }],
77
+ '@typescript-eslint/no-useless-constructor': 'error',
78
+ '@typescript-eslint/no-var-requires': 'error',
79
+ '@typescript-eslint/object-curly-spacing': 'warn',
80
+ '@typescript-eslint/padding-line-between-statements': ['off', { blankLine: 'always', prev: 'var', next: 'return' }],
81
+ '@typescript-eslint/prefer-as-const': 'warn',
82
+ '@typescript-eslint/prefer-enum-initializers': 'off',
83
+ '@typescript-eslint/prefer-for-of': 'warn',
84
+ '@typescript-eslint/prefer-function-type': 'warn',
85
+ '@typescript-eslint/prefer-literal-enum-member': ['error', { allowBitwiseExpressions: true }],
86
+ '@typescript-eslint/prefer-namespace-keyword': 'error',
87
+ '@typescript-eslint/prefer-nullish-coalescing': 'off',
88
+ '@typescript-eslint/prefer-optional-chain': 'warn',
89
+ '@typescript-eslint/prefer-readonly-parameter-types': [
90
+ 'off',
91
+ { checkParameterProperties: true, ignoreInferredTypes: false, treatMethodsAsReadonly: true },
92
+ ], // I'm not sure...
93
+ '@typescript-eslint/prefer-readonly': 'off',
94
+ '@typescript-eslint/prefer-readonlysemi': 'off', // Annoying with auto-fix on save.
95
+ '@typescript-eslint/prefer-ts-expect-error': 'off',
96
+ '@typescript-eslint/promise-function-async': 'off',
97
+ '@typescript-eslint/restrict-plus-operands': 'off',
98
+ '@typescript-eslint/restrict-template-expressions': [
99
+ 'off',
100
+ { allowNumber: true, allowBoolean: false, allowAny: false, allowNullish: false, allowRegExp: false },
101
+ ],
102
+ '@typescript-eslint/sort-type-union-intersection-members': [
103
+ 'warn',
104
+ {
105
+ checkIntersections: true,
106
+ checkUnions: true,
107
+ groupOrder: [
108
+ 'named',
109
+ 'keyword',
110
+ 'operator',
111
+ 'literal',
112
+ 'function',
113
+ 'import',
114
+ 'conditional',
115
+ 'object',
116
+ 'tuple',
117
+ 'intersection',
118
+ 'union',
119
+ 'nullish',
120
+ ],
121
+ },
122
+ ],
123
+ '@typescript-eslint/strict-boolean-expressions': 'off', // Annoying
124
+ '@typescript-eslint/triple-slash-reference': 'error',
125
+ '@typescript-eslint/typedef': ['error', { parameter: false, arrowParameter: false, variableDeclaration: false }],
126
+ '@typescript-eslint/unified-signatures': 'error',
127
+
128
+ // collisions
129
+ 'camelcase': 'off',
130
+ 'default-param-last': 'off',
131
+ 'init-declarations': 'off',
132
+ 'lines-between-class-members': 'off',
133
+ 'no-duplicate-imports': 'off',
134
+ 'no-invalid-this': 'off',
135
+ 'no-loop-func': 'off',
136
+ 'no-redeclare': 'off',
137
+ 'no-shadow': 'off',
138
+ 'no-unused-vars': 'off',
139
+ 'no-use-before-define': 'off',
140
+ 'no-useless-constructor': 'off',
141
+ 'object-curly-spacing': 'off',
142
+ 'padding-line-between-statements': 'off',
143
+
144
+ // open issues
145
+ 'react/jsx-no-useless-fragment': 'off', // Need useless-fragment for JSX return type
146
+ },
147
+ };
@@ -0,0 +1,23 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'default-param-last': 'warn',
4
+ 'no-restricted-globals': ['error', 'event', 'fdescribe'],
5
+ 'no-delete-var': 'error',
6
+ 'no-label-var': 'error',
7
+ 'no-shadow-restricted-names': 'error',
8
+ 'no-shadow': 'error',
9
+ 'no-undef-init': 'error',
10
+ 'no-undef': 'error',
11
+ 'no-undefined': 'off',
12
+ 'no-unused-vars': [
13
+ 'error',
14
+ {
15
+ argsIgnorePattern: '^_',
16
+ varsIgnorePattern: '^ignore(d)?',
17
+ args: 'after-used',
18
+ ignoreRestSiblings: true,
19
+ },
20
+ ],
21
+ 'no-use-before-define': ['error', 'nofunc'],
22
+ },
23
+ };
package/typecheck.js ADDED
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ overrides: [
3
+ {
4
+ files: ['*.ts', '*.tsx'],
5
+ extends: ['./rules/typescript-requiring-type-checking.js'],
6
+ },
7
+ ],
8
+ };
package/typescript.js ADDED
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ plugins: ['@typescript-eslint/eslint-plugin'],
4
+ settings: {
5
+ 'import/parsers': {
6
+ '@typescript-eslint/parser': ['.ts', '.tsx'],
7
+ },
8
+ 'import/resolver': {
9
+ node: {
10
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts', '.json', '.mjs'],
11
+ },
12
+ },
13
+ },
14
+ overrides: [
15
+ {
16
+ files: ['*.ts', '*.tsx'],
17
+ extends: ['plugin:@typescript-eslint/eslint-recommended', './rules/typescript', 'prettier'],
18
+ },
19
+ ],
20
+ };