@bonniernews/eslint-config 1.0.0-beta.0
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/CHANGELOG.md +111 -0
- package/EDITORS.md +15 -0
- package/LICENSE +21 -0
- package/README.md +136 -0
- package/all.js +14 -0
- package/index.js +44 -0
- package/package.json +66 -0
- package/react-rules.js +39 -0
- package/react.js +18 -0
- package/rules.js +286 -0
- package/test.js +54 -0
- package/typescript-react.js +45 -0
- package/typescript-rules.js +90 -0
- package/typescript.js +20 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
- Renamed to @bonniernews/eslint-config
|
|
6
|
+
|
|
7
|
+
## 0.8.3
|
|
8
|
+
|
|
9
|
+
- fixed typescript-react rules to actually check .ts files
|
|
10
|
+
- disabled import/named for typescript
|
|
11
|
+
|
|
12
|
+
## 0.8.2
|
|
13
|
+
|
|
14
|
+
- bump typescript deps
|
|
15
|
+
|
|
16
|
+
## 0.8.1
|
|
17
|
+
|
|
18
|
+
- fixed broken release
|
|
19
|
+
|
|
20
|
+
## 0.8.0
|
|
21
|
+
|
|
22
|
+
- tsx support by using `exp/typescript-react`
|
|
23
|
+
- removed warning for explicit anys
|
|
24
|
+
|
|
25
|
+
## 0.7.0
|
|
26
|
+
|
|
27
|
+
- TypeScript rules.
|
|
28
|
+
- Bumped major version of `eslint-plugin-n` to 16.
|
|
29
|
+
- Bumped major version of `eslint-plugin-no-only-tests` to 3.
|
|
30
|
+
- Bumped required node version to 16.
|
|
31
|
+
- Added TypeScript as an optional peer dependency.
|
|
32
|
+
|
|
33
|
+
## 0.6.2
|
|
34
|
+
|
|
35
|
+
- Allow deprecated url.resolve and url.parse since new URL has unacceptable performance regressions, see <https://github.com/nodejs/node/issues/30334>.
|
|
36
|
+
|
|
37
|
+
## 0.6.1
|
|
38
|
+
|
|
39
|
+
- Added `"react/jsx-indent-props": [2, 2]` as a rule for react to make indenting jsx props look nice.
|
|
40
|
+
|
|
41
|
+
## 0.6.0
|
|
42
|
+
|
|
43
|
+
- Added support for react using `exp/react`.
|
|
44
|
+
|
|
45
|
+
## 0.5.0
|
|
46
|
+
|
|
47
|
+
Add deprecated rules for node.
|
|
48
|
+
|
|
49
|
+
## 0.4.0
|
|
50
|
+
|
|
51
|
+
- Replace `eslint-plugin-node` with `eslint-plugin-n` as the former is no longer maintained.
|
|
52
|
+
|
|
53
|
+
## 0.3.0
|
|
54
|
+
|
|
55
|
+
Added missing afterEachFeature & beforeEachFeature globals for `mocha-cakes-2`.
|
|
56
|
+
|
|
57
|
+
## 0.2.0
|
|
58
|
+
|
|
59
|
+
- Added support for ES6 module linting, which is activated if `"type": "module"` in your `package.json`
|
|
60
|
+
- For Node versions 16 and above, the ES2022 environment will be activated
|
|
61
|
+
- A new configuration `exp/all` has been added, which adds the test configuration directly in the main `.eslintrc.json`
|
|
62
|
+
|
|
63
|
+
## 0.1.1
|
|
64
|
+
|
|
65
|
+
Consistent spacing for functions and code blocks.
|
|
66
|
+
|
|
67
|
+
## 0.1.0
|
|
68
|
+
|
|
69
|
+
New rules to format objects: either all properties on the same line OR use multiline.
|
|
70
|
+
|
|
71
|
+
## 0.0.9
|
|
72
|
+
|
|
73
|
+
Updated `eslint` peer dependency to v8.
|
|
74
|
+
|
|
75
|
+
## 0.0.8
|
|
76
|
+
|
|
77
|
+
`eslint-plugin-node` is now included in the package and has migrated the following rules:
|
|
78
|
+
|
|
79
|
+
- `node/handle-callback-err`
|
|
80
|
+
- `node/no-path-concat`
|
|
81
|
+
- `node/no-process-exit`
|
|
82
|
+
|
|
83
|
+
Behavior remains unchanged.
|
|
84
|
+
|
|
85
|
+
## 0.0.7
|
|
86
|
+
|
|
87
|
+
`function` is now exempt from the `comma-dangle` rule.
|
|
88
|
+
|
|
89
|
+
## 0.0.6
|
|
90
|
+
|
|
91
|
+
Add the `comma-dangle` rule with `always-multiline`.
|
|
92
|
+
|
|
93
|
+
## 0.0.5
|
|
94
|
+
|
|
95
|
+
Add the switch-colon-spacing rule.
|
|
96
|
+
|
|
97
|
+
## 0.0.4
|
|
98
|
+
|
|
99
|
+
Remove some ignorePatterns that shouldn't be ignored.
|
|
100
|
+
|
|
101
|
+
## 0.0.3
|
|
102
|
+
|
|
103
|
+
No changes. Fixes bad publish.
|
|
104
|
+
|
|
105
|
+
## 0.0.2
|
|
106
|
+
|
|
107
|
+
Use new-cap in standard configuration.
|
|
108
|
+
|
|
109
|
+
## 0.0.1
|
|
110
|
+
|
|
111
|
+
Initial working version.
|
package/EDITORS.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Editors
|
|
2
|
+
|
|
3
|
+
## Visual Studio Code
|
|
4
|
+
|
|
5
|
+
Make sure you have a recent version of the [_ESLint_ extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint).
|
|
6
|
+
|
|
7
|
+
### Enable auto-save
|
|
8
|
+
|
|
9
|
+
Add the following to your _User_ (all projects) or _Workspace_ (specific project) settings (Select _Code_/_Preferences_/_Settings_ and then search for "Code Actions On Save" and click the `Edit in settings.json` link).
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
"editor.codeActionsOnSave": {
|
|
13
|
+
"source.fixAll.eslint": true
|
|
14
|
+
},
|
|
15
|
+
```
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Bonnier News AB
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# @bonniernews/eslint-config
|
|
2
|
+
|
|
3
|
+
[](https://github.com/BonnierNews/eslint-config/actions/workflows/run-tests.yml)
|
|
4
|
+
|
|
5
|
+
Basic [ESLint](https://eslint.org/) rules used by [Bonnier News](https://www.bonniernews.se). The configuration works both with CommonJS and ES6 modules,
|
|
6
|
+
and the appropriate setup will be used by looking at the projects `package.json` [type property](https://nodejs.org/api/packages.html#type).
|
|
7
|
+
|
|
8
|
+
For Node versions that support it (version 16 and above), the `es2022` environment will also be activated. Otherwise `es2021` will be used.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Install `eslint` and `@bonniernews/eslint-config`:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install --save-dev eslint @bonniernews/eslint-config
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Base configuration
|
|
19
|
+
|
|
20
|
+
To activate the config, you need to add the following to your `.eslintrc.json`-file:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"root": true,
|
|
25
|
+
"extends": [ "@bonniernews" ]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### React configuration
|
|
30
|
+
|
|
31
|
+
To activate the config, you need to add the following to your `.eslintrc.json`-file:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"root": true,
|
|
36
|
+
"extends": [ "@bonniernews/react" ]
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This will enable the react plugin for `*.jsx`-files.
|
|
41
|
+
|
|
42
|
+
### TypeScript configuration
|
|
43
|
+
|
|
44
|
+
To activate the config, you need to add the following to your `.eslintrc.json`-file:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"root": true,
|
|
49
|
+
"extends": [ "@bonniernews/typescript" ]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This will enable the typescript plugin for `*.ts`-files.
|
|
54
|
+
|
|
55
|
+
### React with TypeScript configuration
|
|
56
|
+
|
|
57
|
+
To activate the config, you need to add the following to your `.eslintrc.json`-file:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"root": true,
|
|
62
|
+
"extends": [ "@bonniernews/typescript-react" ]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This will enable the typescript and react plugin for `*.tsx`-files.
|
|
67
|
+
|
|
68
|
+
### Test configuration
|
|
69
|
+
|
|
70
|
+
You can also choose to use the test config, which is adapted to testing using `mocha`, `mocha-cakes-2` and `chai`. To also enable this,
|
|
71
|
+
either add a separate test configuration file extending from `"@bonniernews/test"`, or use the `"@bonniernews/all"` in your root configuration to activate
|
|
72
|
+
everything together:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"root": true,
|
|
77
|
+
"extends": [ "@bonniernews/all" ]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This will activate the test configuration for all files inside directories named `test` or `tests`.
|
|
82
|
+
|
|
83
|
+
### Running eslint
|
|
84
|
+
|
|
85
|
+
Run with:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx eslint .
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Usage in an existing project
|
|
92
|
+
|
|
93
|
+
- We advice to remove any `husky` hooks that uses libraries such as `pretty-quick` from your `package.json`
|
|
94
|
+
- Subsequently remove any use of `pretty-quick` if possible.
|
|
95
|
+
- Remove any previous use of sharable [_ESLint_ configs](https://eslint.org/docs/developer-guide/shareable-configs) from `package.json`, i.e.:
|
|
96
|
+
- `eslint-config-airbnb`
|
|
97
|
+
- `eslint-config-google`
|
|
98
|
+
- `eslint-config-prettier`
|
|
99
|
+
- Remove `eslint-plugin-prettier` from `package.json`
|
|
100
|
+
- If you get errors similar to the ones below, please update the `eslint` dependancy.
|
|
101
|
+
- _Definition for rule 'no-nonoctal-decimal-escape' was not found_
|
|
102
|
+
- _Definition for rule 'no-unsafe-optional-chaining' was not found_
|
|
103
|
+
- If you still have issues; try updating `npm` (if you use _nvm_ `nvm install-latest-npm`) & `prettier` as-well
|
|
104
|
+
- Remove any 'eslint-disable-line no-unused-expressions' directives added because of chai assertions, they are not
|
|
105
|
+
needed anymore (`eslint-plugin-chai-friendly` is used in test).
|
|
106
|
+
- Remove any globals and special rules related to `mocha-cakes-2` in your test configuration, they already exist
|
|
107
|
+
in the `@bonniernews/test` and `@bonniernews/all` configs.
|
|
108
|
+
|
|
109
|
+
Once you complete the steps above run the following:
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
npx eslint . --fix
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Usage with Prettier
|
|
116
|
+
|
|
117
|
+
If you want to use _Prettier_, run it before eslint. ESLint should be the final judge, i.e. run:
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
npx prettier --save .
|
|
121
|
+
npx eslint . --fix
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This will format the entire code base according to the rules of _Prettier_ and the config.
|
|
125
|
+
|
|
126
|
+
## Enable format on save
|
|
127
|
+
|
|
128
|
+
- [Visual Studio Code](EDITORS.md#visual-studio-code)
|
|
129
|
+
|
|
130
|
+
## Changelog
|
|
131
|
+
|
|
132
|
+
Can be found [here](CHANGELOG.md).
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
Released under the [MIT license](https://tldrlegal.com/license/mit-license).
|
package/all.js
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const getRules = require("./rules");
|
|
6
|
+
|
|
7
|
+
// This will take care of potential symlinks
|
|
8
|
+
const appDir = fs.realpathSync(process.cwd());
|
|
9
|
+
|
|
10
|
+
const isModuleProject = require(path.resolve(appDir, "package.json")).type === "module";
|
|
11
|
+
const hasES2022Support = parseInt(process.versions.node.split(".").shift(), 10) >= 16;
|
|
12
|
+
|
|
13
|
+
const moduleConfig = {
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaVersion: hasES2022Support ? 2022 : 2021,
|
|
16
|
+
sourceType: "module",
|
|
17
|
+
},
|
|
18
|
+
env: {
|
|
19
|
+
node: true,
|
|
20
|
+
...(hasES2022Support ? { es2022: true } : { es6: true }),
|
|
21
|
+
},
|
|
22
|
+
plugins: [ "eslint-plugin-n", "import" ],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const commonjsConfig = {
|
|
26
|
+
parserOptions: { ecmaVersion: 2021 },
|
|
27
|
+
env: {
|
|
28
|
+
node: true,
|
|
29
|
+
es6: true,
|
|
30
|
+
},
|
|
31
|
+
plugins: [ "eslint-plugin-n" ],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
ignorePatterns: [
|
|
36
|
+
"tmp/",
|
|
37
|
+
"public/",
|
|
38
|
+
"submodule/**",
|
|
39
|
+
"logs/",
|
|
40
|
+
"docs/",
|
|
41
|
+
],
|
|
42
|
+
...(isModuleProject ? moduleConfig : commonjsConfig),
|
|
43
|
+
rules: getRules(isModuleProject),
|
|
44
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bonniernews/eslint-config",
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
|
+
"description": "ESLint config",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "mocha && eslint ."
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/BonnierNews/eslint-config"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"eslint",
|
|
15
|
+
"eslintconfig",
|
|
16
|
+
"config",
|
|
17
|
+
"bonniernews",
|
|
18
|
+
"javascript",
|
|
19
|
+
"styleguide"
|
|
20
|
+
],
|
|
21
|
+
"contributors": [],
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"chai": "^4.3.7",
|
|
24
|
+
"eslint": "^8.19.0",
|
|
25
|
+
"mocha": "^10.2.0",
|
|
26
|
+
"mocha-cakes-2": "^3.3.0",
|
|
27
|
+
"typescript": "^5.2.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"eslint": ">=8.3.0",
|
|
31
|
+
"typescript": ">=5.1.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"typescript": {
|
|
35
|
+
"optional": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=16"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
|
44
|
+
"@typescript-eslint/parser": "^6.6.0",
|
|
45
|
+
"eslint-plugin-chai-friendly": "^0.7.2",
|
|
46
|
+
"eslint-plugin-import": "^2.27.5",
|
|
47
|
+
"eslint-plugin-n": "^16.0.1",
|
|
48
|
+
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
49
|
+
"eslint-plugin-react": "^7.32.2"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"all.js",
|
|
53
|
+
"index.js",
|
|
54
|
+
"react-rules.js",
|
|
55
|
+
"react.js",
|
|
56
|
+
"rules.js",
|
|
57
|
+
"test.js",
|
|
58
|
+
"typescript-react.js",
|
|
59
|
+
"typescript-rules.js",
|
|
60
|
+
"typescript.js",
|
|
61
|
+
"README.md",
|
|
62
|
+
"CHANGELOG.md",
|
|
63
|
+
"EDITORS.md",
|
|
64
|
+
"LICENSE"
|
|
65
|
+
]
|
|
66
|
+
}
|
package/react-rules.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const eslintReactRecommendedRules = {
|
|
4
|
+
"react/display-name": 2,
|
|
5
|
+
"react/jsx-key": 2,
|
|
6
|
+
"react/jsx-no-comment-textnodes": 2,
|
|
7
|
+
"react/jsx-no-duplicate-props": 2,
|
|
8
|
+
"react/jsx-no-target-blank": 2,
|
|
9
|
+
"react/jsx-no-undef": 2,
|
|
10
|
+
"react/jsx-uses-react": 2,
|
|
11
|
+
"react/jsx-uses-vars": 2,
|
|
12
|
+
"react/no-children-prop": 2,
|
|
13
|
+
"react/no-danger-with-children": 2,
|
|
14
|
+
"react/no-deprecated": 2,
|
|
15
|
+
"react/no-direct-mutation-state": 2,
|
|
16
|
+
"react/no-find-dom-node": 2,
|
|
17
|
+
"react/no-is-mounted": 2,
|
|
18
|
+
"react/no-render-return-value": 2,
|
|
19
|
+
"react/no-string-refs": 2,
|
|
20
|
+
"react/no-unescaped-entities": 2,
|
|
21
|
+
"react/no-unknown-property": 2,
|
|
22
|
+
"react/no-unsafe": 0,
|
|
23
|
+
"react/react-in-jsx-scope": 2,
|
|
24
|
+
"react/require-render-return": 2,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
...eslintReactRecommendedRules,
|
|
29
|
+
"react/prop-types": 0,
|
|
30
|
+
"react/jsx-first-prop-new-line": [ 2, "multiline" ],
|
|
31
|
+
"react/jsx-max-props-per-line": [ 2, { maximum: { single: 3, multi: 1 } } ],
|
|
32
|
+
"react/jsx-closing-bracket-location": [ 2, "tag-aligned" ],
|
|
33
|
+
"react/destructuring-assignment": [ 2, "always" ],
|
|
34
|
+
"react/prefer-stateless-function": [ 2, { ignorePureComponents: false } ],
|
|
35
|
+
"react/function-component-definition": [ 2, { namedComponents: "function-declaration", unnamedComponents: "arrow-function" } ],
|
|
36
|
+
"react/jsx-indent": [ 2, 2 ],
|
|
37
|
+
"react/jsx-tag-spacing": [ 2, { beforeSelfClosing: "always" } ],
|
|
38
|
+
"react/jsx-indent-props": [ 2, 2 ],
|
|
39
|
+
};
|
package/react.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const baseConfig = require(".");
|
|
4
|
+
const reactRules = require("./react-rules");
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
...baseConfig,
|
|
8
|
+
overrides: [
|
|
9
|
+
{
|
|
10
|
+
plugins: [
|
|
11
|
+
"react",
|
|
12
|
+
],
|
|
13
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
14
|
+
files: [ "*.jsx" ],
|
|
15
|
+
rules: reactRules,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
package/rules.js
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const eslintRecommendedRules = {
|
|
4
|
+
"constructor-super": "error",
|
|
5
|
+
"for-direction": "error",
|
|
6
|
+
"getter-return": "error",
|
|
7
|
+
"no-async-promise-executor": "error",
|
|
8
|
+
"no-case-declarations": "error",
|
|
9
|
+
"no-class-assign": "error",
|
|
10
|
+
"no-compare-neg-zero": "error",
|
|
11
|
+
"no-cond-assign": "error",
|
|
12
|
+
"no-const-assign": "error",
|
|
13
|
+
"no-constant-condition": "error",
|
|
14
|
+
"no-control-regex": "error",
|
|
15
|
+
"no-debugger": "error",
|
|
16
|
+
"no-delete-var": "error",
|
|
17
|
+
"no-dupe-args": "error",
|
|
18
|
+
"no-dupe-class-members": "error",
|
|
19
|
+
"no-dupe-else-if": "error",
|
|
20
|
+
"no-dupe-keys": "error",
|
|
21
|
+
"no-duplicate-case": "error",
|
|
22
|
+
"no-empty": "error",
|
|
23
|
+
"no-empty-character-class": "error",
|
|
24
|
+
"no-empty-pattern": "error",
|
|
25
|
+
"no-ex-assign": "error",
|
|
26
|
+
"no-extra-boolean-cast": "error",
|
|
27
|
+
"no-extra-semi": "error",
|
|
28
|
+
"no-fallthrough": "error",
|
|
29
|
+
"no-func-assign": "error",
|
|
30
|
+
"no-global-assign": "error",
|
|
31
|
+
"no-import-assign": "error",
|
|
32
|
+
"no-inner-declarations": "error",
|
|
33
|
+
"no-invalid-regexp": "error",
|
|
34
|
+
"no-irregular-whitespace": "error",
|
|
35
|
+
"no-loss-of-precision": "error",
|
|
36
|
+
"no-misleading-character-class": "error",
|
|
37
|
+
"no-mixed-spaces-and-tabs": "error",
|
|
38
|
+
"no-new-symbol": "error",
|
|
39
|
+
"no-nonoctal-decimal-escape": "error",
|
|
40
|
+
"no-obj-calls": "error",
|
|
41
|
+
"no-octal": "error",
|
|
42
|
+
"no-prototype-builtins": "error",
|
|
43
|
+
"no-redeclare": "error",
|
|
44
|
+
"no-regex-spaces": "error",
|
|
45
|
+
"no-self-assign": "error",
|
|
46
|
+
"no-setter-return": "error",
|
|
47
|
+
"no-shadow-restricted-names": "error",
|
|
48
|
+
"no-sparse-arrays": "error",
|
|
49
|
+
"no-this-before-super": "error",
|
|
50
|
+
"no-undef": "error",
|
|
51
|
+
"no-unexpected-multiline": "error",
|
|
52
|
+
"no-unreachable": "error",
|
|
53
|
+
"no-unsafe-finally": "error",
|
|
54
|
+
"no-unsafe-negation": "error",
|
|
55
|
+
"no-unsafe-optional-chaining": "error",
|
|
56
|
+
"no-unused-labels": "error",
|
|
57
|
+
"no-unused-vars": "error",
|
|
58
|
+
"no-useless-backreference": "error",
|
|
59
|
+
"no-useless-catch": "error",
|
|
60
|
+
"no-useless-escape": "error",
|
|
61
|
+
"no-with": "error",
|
|
62
|
+
"require-yield": "error",
|
|
63
|
+
"use-isnan": "error",
|
|
64
|
+
"valid-typeof": "error",
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const nodeRecommendedRules = {
|
|
68
|
+
"n/handle-callback-err": "error",
|
|
69
|
+
"n/no-path-concat": "error",
|
|
70
|
+
"n/no-process-exit": "error",
|
|
71
|
+
"n/no-deprecated-api": [ 2, { ignoreModuleItems: [ "url.parse", "url.resolve" ] } ], // until the performance regression for new URL has been resolved in lts
|
|
72
|
+
"n/prefer-global/url-search-params": "error",
|
|
73
|
+
"n/prefer-global/url": "error",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const starterAppRules = {
|
|
77
|
+
"arrow-parens": "error",
|
|
78
|
+
"arrow-spacing": "error",
|
|
79
|
+
"brace-style": [
|
|
80
|
+
"error",
|
|
81
|
+
"1tbs",
|
|
82
|
+
{ allowSingleLine: false },
|
|
83
|
+
],
|
|
84
|
+
"comma-dangle": [
|
|
85
|
+
"error",
|
|
86
|
+
{
|
|
87
|
+
arrays: "always-multiline",
|
|
88
|
+
objects: "always-multiline",
|
|
89
|
+
imports: "always-multiline",
|
|
90
|
+
exports: "always-multiline",
|
|
91
|
+
functions: "never",
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
"comma-spacing": "error",
|
|
95
|
+
curly: [
|
|
96
|
+
"error",
|
|
97
|
+
"multi-line",
|
|
98
|
+
],
|
|
99
|
+
"dot-notation": [
|
|
100
|
+
"error",
|
|
101
|
+
{ allowKeywords: true },
|
|
102
|
+
],
|
|
103
|
+
"eol-last": "error",
|
|
104
|
+
eqeqeq: "error",
|
|
105
|
+
"key-spacing": [
|
|
106
|
+
"error",
|
|
107
|
+
{
|
|
108
|
+
beforeColon: false,
|
|
109
|
+
afterColon: true,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
"keyword-spacing": "error",
|
|
113
|
+
"new-parens": "error",
|
|
114
|
+
"no-alert": "error",
|
|
115
|
+
"no-array-constructor": "error",
|
|
116
|
+
"no-caller": "error",
|
|
117
|
+
"no-catch-shadow": "error",
|
|
118
|
+
"no-eval": "error",
|
|
119
|
+
"no-extend-native": "error",
|
|
120
|
+
"no-extra-bind": "error",
|
|
121
|
+
"no-extra-parens": [
|
|
122
|
+
"error",
|
|
123
|
+
"functions",
|
|
124
|
+
],
|
|
125
|
+
"no-implied-eval": "error",
|
|
126
|
+
"no-iterator": "error",
|
|
127
|
+
"no-label-var": "error",
|
|
128
|
+
"no-labels": "error",
|
|
129
|
+
"no-lone-blocks": "error",
|
|
130
|
+
"no-loop-func": "error",
|
|
131
|
+
"no-multi-spaces": "error",
|
|
132
|
+
"no-multi-str": "error",
|
|
133
|
+
"no-native-reassign": "error",
|
|
134
|
+
"no-new": "error",
|
|
135
|
+
"no-new-func": "error",
|
|
136
|
+
"no-new-object": "error",
|
|
137
|
+
"no-new-wrappers": "error",
|
|
138
|
+
"no-octal-escape": "error",
|
|
139
|
+
"no-proto": "error",
|
|
140
|
+
"no-return-assign": "error",
|
|
141
|
+
"no-script-url": "error",
|
|
142
|
+
"no-sequences": "error",
|
|
143
|
+
"no-shadow": "error",
|
|
144
|
+
"no-spaced-func": "error",
|
|
145
|
+
"no-trailing-spaces": "error",
|
|
146
|
+
"no-undef-init": "error",
|
|
147
|
+
"no-underscore-dangle": "off",
|
|
148
|
+
"no-unused-expressions": "error",
|
|
149
|
+
"no-use-before-define": [
|
|
150
|
+
"error",
|
|
151
|
+
"nofunc",
|
|
152
|
+
],
|
|
153
|
+
"no-var": "error",
|
|
154
|
+
"prefer-arrow-callback": "error",
|
|
155
|
+
"prefer-const": [
|
|
156
|
+
"error",
|
|
157
|
+
{ destructuring: "all" },
|
|
158
|
+
],
|
|
159
|
+
quotes: [
|
|
160
|
+
"error",
|
|
161
|
+
"double",
|
|
162
|
+
{ avoidEscape: true },
|
|
163
|
+
],
|
|
164
|
+
semi: [
|
|
165
|
+
"error",
|
|
166
|
+
"always",
|
|
167
|
+
],
|
|
168
|
+
"semi-spacing": [
|
|
169
|
+
"error",
|
|
170
|
+
{
|
|
171
|
+
before: false,
|
|
172
|
+
after: true,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
"space-before-blocks": "error",
|
|
176
|
+
"space-before-function-paren": [ "error", {
|
|
177
|
+
anonymous: "always",
|
|
178
|
+
named: "never",
|
|
179
|
+
asyncArrow: "always",
|
|
180
|
+
} ],
|
|
181
|
+
"space-infix-ops": "error",
|
|
182
|
+
"space-unary-ops": [
|
|
183
|
+
"error",
|
|
184
|
+
{
|
|
185
|
+
words: true,
|
|
186
|
+
nonwords: false,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
"space-in-parens": [ "error", "never" ],
|
|
190
|
+
strict: [
|
|
191
|
+
"error",
|
|
192
|
+
"global",
|
|
193
|
+
],
|
|
194
|
+
yoda: [
|
|
195
|
+
"error",
|
|
196
|
+
"never",
|
|
197
|
+
],
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const importRules = {
|
|
201
|
+
"no-duplicate-imports": "error",
|
|
202
|
+
"import/no-unresolved": "error",
|
|
203
|
+
"import/named": "error",
|
|
204
|
+
"import/namespace": "error",
|
|
205
|
+
"import/order": [ "error", {
|
|
206
|
+
groups: [ [ "builtin", "external" ] ],
|
|
207
|
+
"newlines-between": "always",
|
|
208
|
+
} ],
|
|
209
|
+
"import/extensions": [
|
|
210
|
+
"error",
|
|
211
|
+
"ignorePackages",
|
|
212
|
+
{
|
|
213
|
+
ts: "never", // since we do not add .ts to imports...
|
|
214
|
+
tsx: "never",
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
"import/default": "error",
|
|
218
|
+
"import/no-dynamic-require": "error",
|
|
219
|
+
"import/no-self-import": "error",
|
|
220
|
+
"import/no-cycle": [ "error", { maxDepth: 2, ignoreExternal: true } ],
|
|
221
|
+
"import/no-useless-path-segments": "error",
|
|
222
|
+
"import/export": "error",
|
|
223
|
+
"import/no-named-as-default": "error",
|
|
224
|
+
"import/no-named-as-default-member": "error",
|
|
225
|
+
"import/no-mutable-exports": "error",
|
|
226
|
+
"import/no-commonjs": "error",
|
|
227
|
+
"import/first": "error",
|
|
228
|
+
"import/no-duplicates": "error",
|
|
229
|
+
"import/newline-after-import": "error",
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
module.exports = function getRules(isModuleProject) {
|
|
233
|
+
return {
|
|
234
|
+
...eslintRecommendedRules,
|
|
235
|
+
...nodeRecommendedRules,
|
|
236
|
+
...starterAppRules,
|
|
237
|
+
...(isModuleProject ? importRules : {}),
|
|
238
|
+
// good stuff..
|
|
239
|
+
"no-multiple-empty-lines": [ "error", {
|
|
240
|
+
max: 1,
|
|
241
|
+
maxEOF: 0,
|
|
242
|
+
maxBOF: 0,
|
|
243
|
+
} ],
|
|
244
|
+
camelcase: [ "error", { properties: "never" } ],
|
|
245
|
+
"quote-props": [ "error", "as-needed" ],
|
|
246
|
+
"spaced-comment": "error",
|
|
247
|
+
indent: [ "error", 2, {
|
|
248
|
+
SwitchCase: 1,
|
|
249
|
+
// list derived from https://raw.githubusercontent.com/benjamn/ast-types/master/src/def/jsx.ts
|
|
250
|
+
ignoredNodes: [
|
|
251
|
+
"JSXAttribute",
|
|
252
|
+
"JSXClosingElement",
|
|
253
|
+
"JSXElement",
|
|
254
|
+
"JSXEmptyExpression",
|
|
255
|
+
"JSXExpressionContainer",
|
|
256
|
+
"JSXFragment",
|
|
257
|
+
"JSXIdentifier",
|
|
258
|
+
"JSXMemberExpression",
|
|
259
|
+
"JSXNamespacedName",
|
|
260
|
+
"JSXOpeningElement",
|
|
261
|
+
"JSXOpeningFragment",
|
|
262
|
+
"JSXSpreadAttribute",
|
|
263
|
+
"JSXSpreadChild",
|
|
264
|
+
"JSXText",
|
|
265
|
+
],
|
|
266
|
+
ignoreComments: false,
|
|
267
|
+
} ],
|
|
268
|
+
"no-whitespace-before-property": "error",
|
|
269
|
+
"no-console": "error", // was warn in node-starterapp
|
|
270
|
+
"prefer-template": "error", // was warn in node-starterapp
|
|
271
|
+
"no-useless-concat": "error",
|
|
272
|
+
"template-curly-spacing": [ "error", "never" ], // make prefer-template --fix nice
|
|
273
|
+
"linebreak-style": [ "error", "unix" ], // use unix style eol
|
|
274
|
+
"eol-last": [ "error", "always" ], // always eol at the end of a file
|
|
275
|
+
"no-nested-ternary": "error", // unreadable code
|
|
276
|
+
"require-await": "error", // make it explicit
|
|
277
|
+
"object-shorthand": [ "error", "properties" ], // make it short
|
|
278
|
+
"object-curly-spacing": [ "error", "always" ], // consistency
|
|
279
|
+
"array-bracket-spacing": [ "error", "always" ], // consistency with above
|
|
280
|
+
"new-cap": "error", // consistency with test rules
|
|
281
|
+
"switch-colon-spacing": "error",
|
|
282
|
+
// object declarations, either all props on the same line or newline per property
|
|
283
|
+
"object-curly-newline": [ "error", { multiline: true } ],
|
|
284
|
+
"object-property-newline": [ "error", { allowAllPropertiesOnSameLine: true } ],
|
|
285
|
+
};
|
|
286
|
+
};
|
package/test.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const mochaCakes2Globals = {
|
|
4
|
+
And: "readonly",
|
|
5
|
+
But: "readonly",
|
|
6
|
+
Feature: "readonly",
|
|
7
|
+
Given: "readonly",
|
|
8
|
+
Scenario: "readonly",
|
|
9
|
+
Then: "readonly",
|
|
10
|
+
When: "readonly",
|
|
11
|
+
should: "readonly",
|
|
12
|
+
expect: "readonly",
|
|
13
|
+
afterEachScenario: "readonly",
|
|
14
|
+
beforeEachScenario: "readonly",
|
|
15
|
+
afterEachFeature: "readonly",
|
|
16
|
+
beforeEachFeature: "readonly",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const mochaCakes2Rules = {
|
|
20
|
+
"new-cap": [
|
|
21
|
+
2,
|
|
22
|
+
{
|
|
23
|
+
capIsNewExceptions: [
|
|
24
|
+
"Feature",
|
|
25
|
+
"Scenario",
|
|
26
|
+
"Given",
|
|
27
|
+
"When",
|
|
28
|
+
"Then",
|
|
29
|
+
"And",
|
|
30
|
+
"But",
|
|
31
|
+
"I",
|
|
32
|
+
"System",
|
|
33
|
+
"Describe",
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
module.exports = {
|
|
40
|
+
env: { mocha: true },
|
|
41
|
+
globals: { ...mochaCakes2Globals },
|
|
42
|
+
plugins: [ "no-only-tests", "chai-friendly" ],
|
|
43
|
+
rules: {
|
|
44
|
+
...mochaCakes2Rules,
|
|
45
|
+
// no only in tests
|
|
46
|
+
"no-only-tests/no-only-tests": [
|
|
47
|
+
"error",
|
|
48
|
+
{ block: [ "Feature", "Scenario", "it", "Describe" ] },
|
|
49
|
+
],
|
|
50
|
+
// chai friendly
|
|
51
|
+
"no-unused-expressions": 0,
|
|
52
|
+
"chai-friendly/no-unused-expressions": 2,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const baseConfig = require(".");
|
|
4
|
+
const typescriptRules = require("./typescript-rules");
|
|
5
|
+
const reactRules = require("./react-rules");
|
|
6
|
+
const settings = { "import/resolver": { node: { extensions: [ ".ts", ".js", ".tsx", ".jsx" ] } } };
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
...baseConfig,
|
|
10
|
+
overrides: [
|
|
11
|
+
{
|
|
12
|
+
parser: "@typescript-eslint/parser",
|
|
13
|
+
parserOptions: { sourceType: "module", ecmaFeatures: { jsx: true } },
|
|
14
|
+
plugins: [
|
|
15
|
+
"react",
|
|
16
|
+
"@typescript-eslint",
|
|
17
|
+
],
|
|
18
|
+
settings,
|
|
19
|
+
files: [ "*.tsx" ],
|
|
20
|
+
rules: {
|
|
21
|
+
...typescriptRules,
|
|
22
|
+
...reactRules,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
parser: "@typescript-eslint/parser",
|
|
27
|
+
parserOptions: { sourceType: "module" },
|
|
28
|
+
settings,
|
|
29
|
+
plugins: [
|
|
30
|
+
"@typescript-eslint",
|
|
31
|
+
],
|
|
32
|
+
files: [ "*.ts" ],
|
|
33
|
+
rules: typescriptRules,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
plugins: [
|
|
37
|
+
"react",
|
|
38
|
+
],
|
|
39
|
+
settings,
|
|
40
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
41
|
+
files: [ "*.jsx" ],
|
|
42
|
+
rules: reactRules,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const typescriptEslintRecommended = {
|
|
4
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
5
|
+
"@typescript-eslint/ban-ts-comment": "error",
|
|
6
|
+
"@typescript-eslint/ban-types": "error",
|
|
7
|
+
"no-array-constructor": "off",
|
|
8
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
9
|
+
"no-empty-function": "off",
|
|
10
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
11
|
+
"@typescript-eslint/no-empty-interface": "error",
|
|
12
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
13
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
14
|
+
"no-extra-semi": "off",
|
|
15
|
+
"@typescript-eslint/no-extra-semi": "error",
|
|
16
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
17
|
+
"no-loss-of-precision": "off",
|
|
18
|
+
"@typescript-eslint/no-loss-of-precision": "error",
|
|
19
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
20
|
+
"@typescript-eslint/no-namespace": "error",
|
|
21
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
22
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
23
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
24
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
25
|
+
"no-unused-vars": "off",
|
|
26
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
|
27
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
28
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
29
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
30
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const disallowNonEcmaScriptCompatibleSyntax = {
|
|
34
|
+
"no-restricted-syntax": [
|
|
35
|
+
"error",
|
|
36
|
+
{
|
|
37
|
+
selector: "ClassDeclaration[abstract=true]",
|
|
38
|
+
message: "Abstract classes aren't allowed.",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
selector: "PropertyDefinition[accessibility=private]",
|
|
42
|
+
message: "Private keyword isn't allowed, use native # instead.",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
selector: "MethodDefinition[decorators.length > 0]",
|
|
46
|
+
message: "Decorators aren't allowed.",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
selector: "TSEnumDeclaration",
|
|
50
|
+
message: "Don't use enums since it is not a type-level extension of JavaScript. Use Objects instead.",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
selector: "ClassDeclaration[superClass]",
|
|
54
|
+
message: "Extending other classes via inheritance isn't allowed. Use composition instead.",
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const eslitRecommendedTs = {
|
|
60
|
+
"constructor-super": "off", // ts(2335) & ts(2377)
|
|
61
|
+
"getter-return": "off", // ts(2378)
|
|
62
|
+
"no-const-assign": "off", // ts(2588)
|
|
63
|
+
"no-dupe-args": "off", // ts(2300)
|
|
64
|
+
"no-dupe-class-members": "off", // ts(2393) & ts(2300)
|
|
65
|
+
"no-dupe-keys": "off", // ts(1117)
|
|
66
|
+
"no-func-assign": "off", // ts(2539)
|
|
67
|
+
"no-import-assign": "off", // ts(2539) & ts(2540)
|
|
68
|
+
"no-new-symbol": "off", // ts(7009)
|
|
69
|
+
"no-obj-calls": "off", // ts(2349)
|
|
70
|
+
"no-redeclare": "off", // ts(2451)
|
|
71
|
+
"no-setter-return": "off", // ts(2408)
|
|
72
|
+
"no-this-before-super": "off", // ts(2376)
|
|
73
|
+
"no-undef": "off", // ts(2304)
|
|
74
|
+
"no-unreachable": "off", // ts(7027)
|
|
75
|
+
"no-unsafe-negation": "off", // ts(2365) & ts(2360) & ts(2358)
|
|
76
|
+
"no-var": "error", // ts transpiles let/const to var, so no need for vars any more
|
|
77
|
+
"prefer-const": "error", // ts provides better types with const
|
|
78
|
+
"prefer-rest-params": "error", // ts provides better types with rest args over arguments
|
|
79
|
+
"prefer-spread": "error", // ts transpiles spread to apply, so no need for manual apply
|
|
80
|
+
"valid-typeof": "off", // ts(2367)
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const importRules = { "import/named": "off" };
|
|
84
|
+
|
|
85
|
+
module.exports = {
|
|
86
|
+
...typescriptEslintRecommended,
|
|
87
|
+
...disallowNonEcmaScriptCompatibleSyntax,
|
|
88
|
+
...eslitRecommendedTs,
|
|
89
|
+
...importRules,
|
|
90
|
+
};
|
package/typescript.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const baseConfig = require(".");
|
|
4
|
+
const typescriptRules = require("./typescript-rules");
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
...baseConfig,
|
|
8
|
+
overrides: [
|
|
9
|
+
{
|
|
10
|
+
parser: "@typescript-eslint/parser",
|
|
11
|
+
parserOptions: { sourceType: "module" },
|
|
12
|
+
settings: { "import/resolver": { node: { extensions: [ ".ts", ".js" ] } } },
|
|
13
|
+
plugins: [
|
|
14
|
+
"@typescript-eslint",
|
|
15
|
+
],
|
|
16
|
+
files: [ "*.ts" ],
|
|
17
|
+
rules: typescriptRules,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|