@wistia/eslint-config 0.17.11 → 0.18.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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
parser: '@typescript-eslint/parser',
|
|
5
|
+
|
|
6
|
+
parserOptions: {
|
|
7
|
+
sourceType: 'module',
|
|
8
|
+
project: './tsconfig.json',
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
env: {
|
|
12
|
+
es2022: true,
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
extends: ['../../rules/eslint/react', '../../rules/eslint/typescript-react'].map(require.resolve),
|
|
16
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
5
|
"main": "react.js",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"./stylelint/scss": "./configs/stylelint/scss.js",
|
|
20
20
|
"./stylelint/styled-components": "./configs/stylelint/styled-components.js",
|
|
21
21
|
"./testing-library": "./configs/eslint/testing-library.js",
|
|
22
|
-
"./typescript": "./configs/eslint/typescript.js"
|
|
22
|
+
"./typescript": "./configs/eslint/typescript.js",
|
|
23
|
+
"./typescript-react": "./configs/eslint/typescript-react.js"
|
|
23
24
|
},
|
|
24
25
|
"scripts": {
|
|
25
26
|
"lint": "eslint --fix .",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// only add typescript rules that concern react development
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
plugins: ['@typescript-eslint'],
|
|
5
|
+
|
|
6
|
+
rules: {
|
|
7
|
+
// Enforce a defaultProps definition for every prop that is not a required prop
|
|
8
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
|
|
9
|
+
// decision: default prop types shouldn't be necessary for optional parameters as they can just default to undefined
|
|
10
|
+
'react/require-default-props': 'off',
|
|
11
|
+
|
|
12
|
+
// Disallow JSX props spreading
|
|
13
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
|
|
14
|
+
// decision: because we have type safety in TypeScript, this rule isn't necessary as we will see
|
|
15
|
+
// TS errors for prop spreading against mismatched (prop)type declarations
|
|
16
|
+
'react/jsx-props-no-spreading': 'off',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
@@ -211,7 +211,7 @@ module.exports = {
|
|
|
211
211
|
|
|
212
212
|
// Require Promise-like statements to be handled appropriately
|
|
213
213
|
// https://typescript-eslint.io/rules/no-floating-promises
|
|
214
|
-
'@typescript-eslint/no-floating-promises':
|
|
214
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
215
215
|
|
|
216
216
|
// Disallow iterating over an array with a for-in loop
|
|
217
217
|
// https://typescript-eslint.io/rules/no-for-in-array
|
|
@@ -546,7 +546,7 @@ module.exports = {
|
|
|
546
546
|
'@typescript-eslint/no-magic-numbers': [
|
|
547
547
|
'error',
|
|
548
548
|
{
|
|
549
|
-
ignore: [-1, 0, 1, 2, 3, 4, 5, 1000, 2000, 3000, 4000, 5000],
|
|
549
|
+
ignore: [-1, 0, 1, 2, 3, 4, 5, 100, 1000, 2000, 3000, 4000, 5000],
|
|
550
550
|
ignoreArrayIndexes: true,
|
|
551
551
|
ignoreDefaultValues: true,
|
|
552
552
|
ignoreTypeIndexes: true,
|