@wistia/eslint-config 0.9.3 → 0.10.0-beta.df1ef34b.0fb50bf
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/configs/eslint/default.js +5 -5
- package/configs/eslint/react.js +0 -2
- package/configs/eslint/typescript.js +27 -0
- package/configs/stylelint/default.js +1 -1
- package/configs/stylelint/scss.js +3 -6
- package/configs/stylelint/styled-components.js +6 -8
- package/package.json +8 -4
- package/rules/eslint/imports.js +3 -1
- package/rules/eslint/react.js +3 -2
- package/rules/eslint/styled-components.js +1 -5
- package/rules/eslint/typescript-imports.js +21 -0
- package/rules/eslint/typescript.js +8 -0
|
@@ -3,11 +3,6 @@ require('@rushstack/eslint-patch/modern-module-resolution');
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
parser: '@babel/eslint-parser',
|
|
5
5
|
|
|
6
|
-
env: {
|
|
7
|
-
es2022: true,
|
|
8
|
-
node: true,
|
|
9
|
-
},
|
|
10
|
-
|
|
11
6
|
parserOptions: {
|
|
12
7
|
sourceType: 'module',
|
|
13
8
|
ecmaFeatures: {
|
|
@@ -17,6 +12,11 @@ module.exports = {
|
|
|
17
12
|
ecmaVersion: 13,
|
|
18
13
|
},
|
|
19
14
|
|
|
15
|
+
env: {
|
|
16
|
+
es2022: true,
|
|
17
|
+
node: true,
|
|
18
|
+
},
|
|
19
|
+
|
|
20
20
|
extends: [
|
|
21
21
|
'../../rules/eslint/best-practices',
|
|
22
22
|
'../../rules/eslint/errors',
|
package/configs/eslint/react.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
parser: '@typescript-eslint/parser',
|
|
5
|
+
|
|
6
|
+
parserOptions: {
|
|
7
|
+
sourceType: 'module',
|
|
8
|
+
ecmaVersion: 13,
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
env: {
|
|
12
|
+
es2022: true,
|
|
13
|
+
node: true,
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
extends: [
|
|
17
|
+
'../../rules/eslint/best-practices',
|
|
18
|
+
'../../rules/eslint/errors',
|
|
19
|
+
'../../rules/eslint/es6',
|
|
20
|
+
'../../rules/eslint/node',
|
|
21
|
+
'../../rules/eslint/imports',
|
|
22
|
+
'../../rules/eslint/style',
|
|
23
|
+
'../../rules/eslint/variables',
|
|
24
|
+
'../../rules/eslint/typescript',
|
|
25
|
+
'../../rules/eslint/typescript-imports',
|
|
26
|
+
].map(require.resolve),
|
|
27
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
plugins: ['stylelint-prettier'],
|
|
3
|
-
extends: ['stylelint-config-standard', 'stylelint-config-prettier']
|
|
3
|
+
extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
|
|
4
4
|
rules: {
|
|
5
5
|
// prettier configuration
|
|
6
6
|
'prettier/prettier': true,
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
// see: https://github.com/stylelint-scss/stylelint-config-standard-scss/blob/main/index.js
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
plugins: ['stylelint-
|
|
5
|
-
extends: ['stylelint-config-standard-scss', '../../rules/stylelint/scss']
|
|
6
|
-
|
|
7
|
-
// prettier configuration
|
|
8
|
-
'prettier/prettier': true,
|
|
9
|
-
},
|
|
4
|
+
plugins: ['stylelint-scss'],
|
|
5
|
+
extends: ['./default.js', 'stylelint-config-standard-scss', '../../rules/stylelint/scss'],
|
|
6
|
+
customSyntax: 'postcss-scss',
|
|
10
7
|
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
plugins: ['stylelint-
|
|
2
|
+
plugins: ['stylelint-declaration-block-no-ignored-properties', 'stylelint-order'],
|
|
3
3
|
extends: [
|
|
4
|
-
'
|
|
4
|
+
'./default.js',
|
|
5
|
+
'stylelint-config-styled-components',
|
|
5
6
|
'../../rules/stylelint/styled-components',
|
|
6
|
-
|
|
7
|
-
].map(require.resolve),
|
|
8
|
-
customSyntax: 'postcss-scss',
|
|
9
|
-
processors: ['stylelint-processor-styled-components'],
|
|
7
|
+
],
|
|
10
8
|
rules: {
|
|
11
|
-
|
|
12
|
-
'prettier/prettier': true,
|
|
9
|
+
'order/properties-alphabetical-order': true,
|
|
13
10
|
},
|
|
11
|
+
customSyntax: '@stylelint/postcss-css-in-js',
|
|
14
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0-beta.df1ef34b.0fb50bf",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
5
|
"main": "react.js",
|
|
6
6
|
"exports": {
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"./stylelint": "./configs/stylelint/default.js",
|
|
16
16
|
"./stylelint/scss": "./configs/stylelint/scss.js",
|
|
17
17
|
"./stylelint/styled-components": "./configs/stylelint/styled-components.js",
|
|
18
|
-
"./testing-library": "./configs/eslint/testing-library.js"
|
|
18
|
+
"./testing-library": "./configs/eslint/testing-library.js",
|
|
19
|
+
"./typescript": "./configs/eslint/typescript.js"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
22
|
"lint": "eslint --fix .",
|
|
@@ -29,12 +30,13 @@
|
|
|
29
30
|
"@babel/eslint-parser": "^7.18.9",
|
|
30
31
|
"@babel/preset-react": "^7.18.6",
|
|
31
32
|
"@rushstack/eslint-patch": "^1.1.4",
|
|
33
|
+
"@stylelint/postcss-css-in-js": "^0.38.0",
|
|
32
34
|
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
|
33
35
|
"@typescript-eslint/parser": "^5.30.7",
|
|
34
36
|
"confusing-browser-globals": "^1.0.11",
|
|
35
37
|
"eslint": "^8.20.0",
|
|
36
38
|
"eslint-config-prettier": "^8.5.0",
|
|
37
|
-
"eslint-
|
|
39
|
+
"eslint-import-resolver-typescript": "^3.3.0",
|
|
38
40
|
"eslint-plugin-cypress": "^2.12.1",
|
|
39
41
|
"eslint-plugin-import": "^2.26.0",
|
|
40
42
|
"eslint-plugin-jest": "^26.6.0",
|
|
@@ -49,14 +51,16 @@
|
|
|
49
51
|
"eslint-plugin-testing-library": "^5.5.1",
|
|
50
52
|
"postcss": "^8.4.14",
|
|
51
53
|
"postcss-scss": "^4.0.4",
|
|
54
|
+
"postcss-syntax": "^0.36.2",
|
|
52
55
|
"prettier": "^2.7.1",
|
|
53
56
|
"stylelint": "^14.9.1",
|
|
54
57
|
"stylelint-config-prettier": "^9.0.3",
|
|
55
58
|
"stylelint-config-standard": "^26.0.0",
|
|
56
59
|
"stylelint-config-standard-scss": "^5.0.0",
|
|
60
|
+
"stylelint-config-styled-components": "^0.1.1",
|
|
57
61
|
"stylelint-declaration-block-no-ignored-properties": "^2.5.0",
|
|
62
|
+
"stylelint-order": "^5.0.0",
|
|
58
63
|
"stylelint-prettier": "^2.0.0",
|
|
59
|
-
"stylelint-processor-styled-components": "^1.10.0",
|
|
60
64
|
"stylelint-scss": "^4.3.0",
|
|
61
65
|
"typescript": "^4.7.4"
|
|
62
66
|
},
|
package/rules/eslint/imports.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = {
|
|
|
7
7
|
extensions: ['.js', '.mjs', '.cjs', '.json'],
|
|
8
8
|
},
|
|
9
9
|
},
|
|
10
|
-
'import/extensions': ['.js', '.jsx', '.mjs', '.cjs'],
|
|
10
|
+
'import/extensions': ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'],
|
|
11
11
|
'import/core-modules': [],
|
|
12
12
|
'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|svg|json)$'],
|
|
13
13
|
},
|
|
@@ -128,6 +128,8 @@ module.exports = {
|
|
|
128
128
|
js: 'never',
|
|
129
129
|
mjs: 'never',
|
|
130
130
|
jsx: 'never',
|
|
131
|
+
ts: 'never',
|
|
132
|
+
tsx: 'never',
|
|
131
133
|
},
|
|
132
134
|
],
|
|
133
135
|
|
package/rules/eslint/react.js
CHANGED
|
@@ -346,7 +346,8 @@ module.exports = {
|
|
|
346
346
|
|
|
347
347
|
// only .jsx files may have JSX
|
|
348
348
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
349
|
-
|
|
349
|
+
// decision: include typescript extensions to allow interop
|
|
350
|
+
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
|
|
350
351
|
|
|
351
352
|
// prevent accidental JS comments from being injected into JSX as text
|
|
352
353
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
@@ -628,7 +629,7 @@ module.exports = {
|
|
|
628
629
|
settings: {
|
|
629
630
|
'import/resolver': {
|
|
630
631
|
node: {
|
|
631
|
-
extensions: ['.js', '.jsx', '.json'],
|
|
632
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
|
|
632
633
|
},
|
|
633
634
|
},
|
|
634
635
|
react: {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// only add styled-components rules
|
|
2
|
-
// see: https://github.com/tinloof/eslint-plugin-better-styled-components#supported-rules
|
|
3
2
|
// see: https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y
|
|
4
3
|
|
|
5
4
|
module.exports = {
|
|
6
|
-
plugins: ['eslint-plugin-
|
|
5
|
+
plugins: ['eslint-plugin-styled-components-a11y'],
|
|
7
6
|
|
|
8
7
|
parserOptions: {
|
|
9
8
|
ecmaFeatures: {
|
|
@@ -12,9 +11,6 @@ module.exports = {
|
|
|
12
11
|
},
|
|
13
12
|
|
|
14
13
|
rules: {
|
|
15
|
-
// sort styled-component properties alphabetically
|
|
16
|
-
'better-styled-components/sort-declarations-alphabetically': 'error',
|
|
17
|
-
|
|
18
14
|
// plugin does not provide definitions
|
|
19
15
|
'styled-components-a11y/accessible-emoji': 'error',
|
|
20
16
|
'styled-components-a11y/alt-text': 'error',
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: ['import'],
|
|
3
|
+
|
|
4
|
+
rules: {
|
|
5
|
+
// turn on errors for missing imports
|
|
6
|
+
'import/no-unresolved': 'error',
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
settings: {
|
|
10
|
+
'import/parsers': {
|
|
11
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
'import/resolver': {
|
|
15
|
+
typescript: {
|
|
16
|
+
// always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
|
|
17
|
+
alwaysTryTypes: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|