@scaleway/eslint-config-react 3.18.4 → 4.0.1
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/emotion.mjs +24 -0
- package/index.mjs +5 -0
- package/javascript.mjs +28 -0
- package/package.json +25 -9
- package/shared.mjs +135 -0
- package/typescript.mjs +77 -0
- package/CHANGELOG.md +0 -1443
- package/emotion.js +0 -15
- package/index.js +0 -6
- package/shared.js +0 -128
- package/typescript.js +0 -56
package/emotion.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: ['@emotion'],
|
|
3
|
-
rules: {
|
|
4
|
-
'react/no-unknown-property': [
|
|
5
|
-
'error',
|
|
6
|
-
{
|
|
7
|
-
ignore: ['css'],
|
|
8
|
-
},
|
|
9
|
-
],
|
|
10
|
-
'@emotion/import-from-emotion': 'error',
|
|
11
|
-
'@emotion/no-vanilla': 'error',
|
|
12
|
-
'@emotion/styled-import': 'error',
|
|
13
|
-
'@emotion/syntax-preference': ['error', 'string'],
|
|
14
|
-
},
|
|
15
|
-
}
|
package/index.js
DELETED
package/shared.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'airbnb/hooks',
|
|
4
|
-
'prettier',
|
|
5
|
-
'plugin:eslint-comments/recommended',
|
|
6
|
-
'plugin:react/jsx-runtime',
|
|
7
|
-
],
|
|
8
|
-
rules: {
|
|
9
|
-
curly: 'error',
|
|
10
|
-
'import/order': [
|
|
11
|
-
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md
|
|
12
|
-
'error',
|
|
13
|
-
{
|
|
14
|
-
alphabetize: {
|
|
15
|
-
caseInsensitive: false,
|
|
16
|
-
order: 'asc',
|
|
17
|
-
},
|
|
18
|
-
groups: [
|
|
19
|
-
['builtin', 'external'],
|
|
20
|
-
'internal',
|
|
21
|
-
'parent',
|
|
22
|
-
'sibling',
|
|
23
|
-
'index',
|
|
24
|
-
],
|
|
25
|
-
'newlines-between': 'never',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
// Here we override airbnb default with our repos dev patterns
|
|
29
|
-
// https://github.com/airbnb/javascript/blob/81157eec2309449b31f36bf8940493623f2530c6/packages/eslint-config-airbnb-base/rules/imports.js#L71
|
|
30
|
-
'import/no-extraneous-dependencies': [
|
|
31
|
-
'error',
|
|
32
|
-
{
|
|
33
|
-
devDependencies: [
|
|
34
|
-
'**/.jest/**',
|
|
35
|
-
'**/.storybook/**',
|
|
36
|
-
'test/**', // tape, common npm pattern
|
|
37
|
-
'tests/**', // also common npm pattern
|
|
38
|
-
'spec/**', // mocha, rspec-like pattern
|
|
39
|
-
'**/__tests__/**', // jest pattern
|
|
40
|
-
'**/__mocks__/**', // jest pattern
|
|
41
|
-
'**/__stories__/**', // stories pattern
|
|
42
|
-
'test.{js,jsx,ts,tsx}', // repos with a single test file
|
|
43
|
-
'test-*.{js,jsx,ts,tsx}', // repos with multiple top-level test files
|
|
44
|
-
'**/*{.,_}{test,spec}.{js,jsx,ts,tsx}', // tests where the extension or filename suffix denotes that it is a test
|
|
45
|
-
'**/jest.config.{js,ts,mjs,mts}', // jest config
|
|
46
|
-
'**/jest.setup.{js,ts,mjs,mts}', // jest setup
|
|
47
|
-
'**/webpack.config.{js,ts,mjs,mts}', // webpack config
|
|
48
|
-
'**/webpack.config.*.{js,ts,mjs,mts}', // webpack config
|
|
49
|
-
'**/rollup.config.{js,ts,mjs,mts}', // rollup config
|
|
50
|
-
'**/rollup.config.*.{js,ts,mjs,mts}', // rollup config
|
|
51
|
-
],
|
|
52
|
-
optionalDependencies: false,
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
// We allow named and default export
|
|
56
|
-
'import/prefer-default-export': 'off',
|
|
57
|
-
// This allows us to reenable ForOfStatement.
|
|
58
|
-
// While this has been disabled in airbnb configuration it's native to the browsers we support
|
|
59
|
-
// so the original argument about weight is no up to date https://github.com/airbnb/javascript/issues/1271
|
|
60
|
-
'no-restricted-syntax': [
|
|
61
|
-
// https://eslint.org/docs/rules/no-restricted-syntax#disallow-specified-syntax-no-restricted-syntax
|
|
62
|
-
'error',
|
|
63
|
-
{
|
|
64
|
-
message:
|
|
65
|
-
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
|
|
66
|
-
selector: 'ForInStatement',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
message:
|
|
70
|
-
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
|
|
71
|
-
selector: 'LabeledStatement',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
message:
|
|
75
|
-
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
|
76
|
-
selector: 'WithStatement',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
message: '`export *` is forbidden.',
|
|
80
|
-
selector: 'ExportAllDeclaration',
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
// This is to have a more breathable codebase
|
|
84
|
-
'padding-line-between-statements': [
|
|
85
|
-
// https://eslint.org/docs/rules/padding-line-between-statements
|
|
86
|
-
'error',
|
|
87
|
-
{
|
|
88
|
-
blankLine: 'always',
|
|
89
|
-
next: 'return',
|
|
90
|
-
prev: '*',
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
// As we don't really care about the function type
|
|
94
|
-
'react/function-component-definition': 'off',
|
|
95
|
-
|
|
96
|
-
// These are rules soon to be enabled by airbnb react config
|
|
97
|
-
// We're getting a head start
|
|
98
|
-
'react/no-adjacent-inline-elements': 'error', // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md
|
|
99
|
-
'prefer-object-has-own': 'error', // https://eslint.org/docs/rules/prefer-object-has-own
|
|
100
|
-
|
|
101
|
-
// Prevent uneeded rerender with object as default props
|
|
102
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/c8f2813758dea1759ba5ab8caf1920cae9417a43/docs/rules/no-object-type-as-default-prop.md
|
|
103
|
-
'react/no-object-type-as-default-prop': 'error',
|
|
104
|
-
|
|
105
|
-
// We don't use babel-preset-airbnb so we can make those changes
|
|
106
|
-
'react/static-property-placement': ['error', 'static public field'],
|
|
107
|
-
'react/state-in-constructor': ['error', 'never'],
|
|
108
|
-
|
|
109
|
-
// To have consistent ordering in proptypes
|
|
110
|
-
'react/sort-prop-types': [
|
|
111
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
|
|
112
|
-
'error',
|
|
113
|
-
{ ignoreCase: true, requiredFirst: false, sortShapeProp: true },
|
|
114
|
-
],
|
|
115
|
-
// Same but for imports
|
|
116
|
-
'sort-imports': [
|
|
117
|
-
// https://eslint.org/docs/rules/sort-imports
|
|
118
|
-
'error',
|
|
119
|
-
{
|
|
120
|
-
ignoreDeclarationSort: true,
|
|
121
|
-
memberSyntaxSortOrder: ['single', 'multiple', 'all', 'none'],
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
'sort-keys': 'off',
|
|
125
|
-
'no-constant-binary-expression': 'error',
|
|
126
|
-
'react/jsx-key': 'error',
|
|
127
|
-
},
|
|
128
|
-
}
|
package/typescript.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'eslint-config-airbnb',
|
|
4
|
-
'eslint-config-airbnb-typescript',
|
|
5
|
-
'plugin:@typescript-eslint/recommended',
|
|
6
|
-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
7
|
-
require.resolve('./shared'),
|
|
8
|
-
],
|
|
9
|
-
plugins: ['deprecation', '@typescript-eslint'],
|
|
10
|
-
rules: {
|
|
11
|
-
// Enforce T[] instead of Array<T>
|
|
12
|
-
'@typescript-eslint/array-type': [
|
|
13
|
-
'error',
|
|
14
|
-
{
|
|
15
|
-
default: 'array',
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
// Avoid toString which are going to generate [object Object]
|
|
19
|
-
'@typescript-eslint/no-base-to-string': 'error',
|
|
20
|
-
// (someCondition === true) => (someCondition)
|
|
21
|
-
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
22
|
-
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
23
|
-
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
24
|
-
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
25
|
-
'@typescript-eslint/prefer-for-of': 'error',
|
|
26
|
-
'@typescript-eslint/prefer-includes': 'error',
|
|
27
|
-
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
28
|
-
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
|
29
|
-
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
30
|
-
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
|
31
|
-
'@typescript-eslint/no-floating-promises': 'error',
|
|
32
|
-
// https://github.com/typescript-eslint/typescript-eslint/issues/4619
|
|
33
|
-
'@typescript-eslint/no-misused-promises': [
|
|
34
|
-
'error',
|
|
35
|
-
{
|
|
36
|
-
checksVoidReturn: {
|
|
37
|
-
attributes: false,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
42
|
-
'@typescript-eslint/no-unused-vars': 'error',
|
|
43
|
-
'@typescript-eslint/consistent-type-imports': 'error',
|
|
44
|
-
'@typescript-eslint/consistent-type-exports': 'error',
|
|
45
|
-
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
46
|
-
'@typescript-eslint/no-redundant-type-constituents': 'warn',
|
|
47
|
-
// We favor object defaults instead of default props in TS
|
|
48
|
-
// https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/default_props/#you-may-not-need-defaultprops
|
|
49
|
-
// https://twitter.com/dan_abramov/status/1133878326358171650
|
|
50
|
-
'react/require-default-props': 'off',
|
|
51
|
-
'react/prop-types': 'off',
|
|
52
|
-
|
|
53
|
-
// To allow <>{expression}</>
|
|
54
|
-
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
|
|
55
|
-
},
|
|
56
|
-
}
|