eslint-config-1stdibs 8.1.0 → 9.1.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/README.md +7 -0
- package/base.js +4 -0
- package/index.js +6 -3
- package/package.json +7 -5
- package/react.js +24 -0
- package/rules/react.js +1 -12
- package/rules/typescript.js +39 -0
- package/typescript.js +37 -46
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Breaking Changes
|
|
4
4
|
|
|
5
|
+
v9.0.0
|
|
6
|
+
|
|
7
|
+
- updated base `eslint` to `^9`
|
|
8
|
+
- provide v9 flat config
|
|
9
|
+
- export default config combined of base, react and ts
|
|
10
|
+
- re-export base config, export react and ts as separate files
|
|
11
|
+
|
|
5
12
|
v5.0.0
|
|
6
13
|
|
|
7
14
|
- deleted `./rules/test.js` since it contained mocha-specific settings, base config contains `jest` rules
|
package/base.js
ADDED
package/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const { defineConfig } = require('eslint/config');
|
|
2
|
+
const baseConfig = require('./base');
|
|
3
|
+
const reactConfig = require('./react');
|
|
4
|
+
const typescriptConfig = require('./typescript');
|
|
5
|
+
|
|
6
|
+
module.exports = defineConfig([...baseConfig, ...reactConfig, ...typescriptConfig]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-1stdibs",
|
|
3
3
|
"github": "https://github.com/1stdibs/eslint-config-1stdibs",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.1.0",
|
|
5
5
|
"description": "ESLint configurations for 1stdibs projects.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": "1stdibs <npm@1stdibs.com> (https://1stdibs.com)",
|
|
@@ -10,20 +10,22 @@
|
|
|
10
10
|
"url": "https://github.com/1stdibs/eslint-config-1stdibs"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
14
|
+
"@eslint/js": "^9.3.4",
|
|
13
15
|
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
14
16
|
"@typescript-eslint/parser": "^8.25.0",
|
|
15
|
-
"eslint-config-1stdibs-base": "^
|
|
17
|
+
"eslint-config-1stdibs-base": "^7.0.0",
|
|
16
18
|
"eslint-plugin-import": "^2.31.0",
|
|
17
19
|
"eslint-plugin-react": "^7.37.4",
|
|
18
|
-
"eslint-plugin-react-hooks": "
|
|
20
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
19
21
|
"eslint-plugin-relay": "^2.0.0"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
|
-
"eslint": "
|
|
24
|
+
"eslint": ">=9.0.0",
|
|
23
25
|
"typescript": "*"
|
|
24
26
|
},
|
|
25
27
|
"peerDependencies": {
|
|
26
|
-
"eslint": "
|
|
28
|
+
"eslint": ">=9.0.0",
|
|
27
29
|
"typescript": "*"
|
|
28
30
|
}
|
|
29
31
|
}
|
package/react.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const { defineConfig } = require('eslint/config');
|
|
2
|
+
|
|
3
|
+
// Plugins
|
|
4
|
+
const reactPlugin = require('eslint-plugin-react');
|
|
5
|
+
const reactHooksPlugin = require('eslint-plugin-react-hooks');
|
|
6
|
+
const relayPlugin = require('eslint-plugin-relay');
|
|
7
|
+
// Rules
|
|
8
|
+
const { rules: reactRules } = require('./rules/react');
|
|
9
|
+
|
|
10
|
+
module.exports = defineConfig([
|
|
11
|
+
{
|
|
12
|
+
plugins: {
|
|
13
|
+
react: reactPlugin,
|
|
14
|
+
'react-hooks': reactHooksPlugin,
|
|
15
|
+
relay: relayPlugin,
|
|
16
|
+
},
|
|
17
|
+
settings: {
|
|
18
|
+
react: {
|
|
19
|
+
version: '19.2',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
rules: reactRules,
|
|
23
|
+
},
|
|
24
|
+
]);
|
package/rules/react.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
extends: ['prettier/react'],
|
|
3
|
-
plugins: ['react', 'react-hooks', 'relay'],
|
|
4
|
-
settings: {
|
|
5
|
-
react: {
|
|
6
|
-
version: '16.5',
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaFeatures: {
|
|
11
|
-
jsx: true,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
2
|
rules: {
|
|
15
3
|
'react/jsx-boolean-value': 'warn',
|
|
16
4
|
'react/jsx-no-duplicate-props': 'error',
|
|
@@ -29,6 +17,7 @@ module.exports = {
|
|
|
29
17
|
'react/prefer-es6-class': ['warn', 'always'],
|
|
30
18
|
'react/prefer-stateless-function': 'warn',
|
|
31
19
|
'react/jsx-no-target-blank': 'warn',
|
|
20
|
+
// Core hooks rules
|
|
32
21
|
'react-hooks/rules-of-hooks': 'error',
|
|
33
22
|
'react-hooks/exhaustive-deps': 'warn',
|
|
34
23
|
// relay
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
rules: {
|
|
3
|
+
'react/prop-types': 'off',
|
|
4
|
+
'@typescript-eslint/camelcase': 'off',
|
|
5
|
+
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
6
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
7
|
+
'@typescript-eslint/prefer-interface': 'off',
|
|
8
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
9
|
+
'error',
|
|
10
|
+
{
|
|
11
|
+
allowExpressions: true,
|
|
12
|
+
allowTypedFunctionExpressions: true,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
'@typescript-eslint/indent': 'off',
|
|
16
|
+
'no-restricted-syntax': [
|
|
17
|
+
'error',
|
|
18
|
+
{
|
|
19
|
+
selector: 'TSEnumDeclaration',
|
|
20
|
+
message: "Don't declare enums. TypeScript + babel issues",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
|
|
24
|
+
'@typescript-eslint/no-inferrable-types': 'off',
|
|
25
|
+
'@typescript-eslint/ban-ts-ignore': 'off',
|
|
26
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
27
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
28
|
+
// turn off generic no-use-before-define
|
|
29
|
+
'no-use-before-define': 'off',
|
|
30
|
+
// turn on ts supported no-use-before-define
|
|
31
|
+
'@typescript-eslint/no-use-before-define': 'error',
|
|
32
|
+
'@typescript-eslint/no-unused-vars': [
|
|
33
|
+
'error',
|
|
34
|
+
{
|
|
35
|
+
caughtErrors: 'none',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
};
|
package/typescript.js
CHANGED
|
@@ -1,47 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'no-use-before-define': 'off',
|
|
38
|
-
// turn on ts supported no-use-before-define
|
|
39
|
-
'@typescript-eslint/no-use-before-define': 'error',
|
|
40
|
-
'@typescript-eslint/no-unused-vars': [
|
|
41
|
-
'error',
|
|
42
|
-
{
|
|
43
|
-
caughtErrors: 'none',
|
|
44
|
-
},
|
|
45
|
-
],
|
|
1
|
+
const { defineConfig } = require('eslint/config');
|
|
2
|
+
const { FlatCompat } = require('@eslint/eslintrc');
|
|
3
|
+
const js = require('@eslint/js');
|
|
4
|
+
|
|
5
|
+
// Plugins
|
|
6
|
+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
|
|
7
|
+
const importPlugin = require('eslint-plugin-import');
|
|
8
|
+
// Parser
|
|
9
|
+
const tsParser = require('@typescript-eslint/parser');
|
|
10
|
+
// Rules
|
|
11
|
+
const { rules: typescriptRules } = require('./rules/typescript');
|
|
12
|
+
|
|
13
|
+
const compat = new FlatCompat({
|
|
14
|
+
baseDirectory: __dirname,
|
|
15
|
+
recommendedConfig: js.configs.recommended,
|
|
16
|
+
allConfig: js.configs.all,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
module.exports = defineConfig([
|
|
20
|
+
{
|
|
21
|
+
files: ['**/*.{ts,tsx,cts,mts}'],
|
|
22
|
+
extends: compat.extends('plugin:@typescript-eslint/recommended'),
|
|
23
|
+
plugins: {
|
|
24
|
+
'@typescript-eslint': tsPlugin,
|
|
25
|
+
},
|
|
26
|
+
languageOptions: {
|
|
27
|
+
parser: tsParser,
|
|
28
|
+
},
|
|
29
|
+
settings: {
|
|
30
|
+
...importPlugin.flatConfigs.typescript.settings,
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
...tsPlugin.configs.recommended.rules,
|
|
34
|
+
...importPlugin.flatConfigs.typescript.rules,
|
|
35
|
+
...typescriptRules,
|
|
36
|
+
},
|
|
46
37
|
},
|
|
47
|
-
|
|
38
|
+
]);
|