@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 ADDED
@@ -0,0 +1,24 @@
1
+ import { rules } from '@emotion/eslint-plugin'
2
+ import { fixupPluginRules } from '@eslint/compat'
3
+
4
+ export default [
5
+ {
6
+ plugins: {
7
+ '@emotion': fixupPluginRules({ rules }),
8
+ },
9
+
10
+ rules: {
11
+ 'react/no-unknown-property': [
12
+ 'error',
13
+ {
14
+ ignore: ['css'],
15
+ },
16
+ ],
17
+
18
+ '@emotion/import-from-emotion': 'error',
19
+ '@emotion/no-vanilla': 'error',
20
+ '@emotion/styled-import': 'error',
21
+ '@emotion/syntax-preference': ['error', 'string'],
22
+ },
23
+ },
24
+ ]
package/index.mjs ADDED
@@ -0,0 +1,5 @@
1
+ import emotion from './emotion.mjs'
2
+ import javascript from './javascript.mjs'
3
+ import typescript from './typescript.mjs'
4
+
5
+ export { emotion, javascript, typescript }
package/javascript.mjs ADDED
@@ -0,0 +1,28 @@
1
+ import { fixupConfigRules } from '@eslint/compat'
2
+ import { FlatCompat } from '@eslint/eslintrc'
3
+ import airbnb from 'eslint-config-airbnb'
4
+ import path from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+ import shared from './shared.mjs'
7
+
8
+ const filename = fileURLToPath(import.meta.url)
9
+ const dirname = path.dirname(filename)
10
+
11
+ const compat = new FlatCompat({
12
+ baseDirectory: dirname,
13
+ })
14
+
15
+ export default [
16
+ ...fixupConfigRules(compat.config(airbnb)),
17
+ ...shared,
18
+ {
19
+ rules: {
20
+ 'react/jsx-filename-extension': [
21
+ 'error',
22
+ {
23
+ extensions: ['.js'],
24
+ },
25
+ ],
26
+ },
27
+ },
28
+ ]
package/package.json CHANGED
@@ -1,40 +1,56 @@
1
1
  {
2
2
  "name": "@scaleway/eslint-config-react",
3
- "version": "3.18.4",
3
+ "version": "4.0.1",
4
4
  "description": "Scaleway React eslint shared config",
5
5
  "keywords": [
6
6
  "eslint",
7
7
  "eslintconfig"
8
8
  ],
9
- "main": "index.js",
10
9
  "publishConfig": {
11
10
  "access": "public"
12
11
  },
12
+ "type": "module",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "https://github.com/scaleway/scaleway-lib",
16
16
  "directory": "packages/eslint-config-react"
17
17
  },
18
+ "exports": {
19
+ ".": "./index.mjs",
20
+ "./javascript": "./javascript.mjs",
21
+ "./typescript": "./typescript.mjs",
22
+ "./emotion": "./emotion.mjs",
23
+ "./shared": "./shared.mjs"
24
+ },
25
+ "files": [
26
+ "index.mjs",
27
+ "javascript.mjs",
28
+ "typescript.mjs",
29
+ "shared.mjs",
30
+ "emotion.mjs"
31
+ ],
18
32
  "license": "MIT",
19
33
  "dependencies": {
20
34
  "@emotion/eslint-plugin": "11.11.0",
21
- "@typescript-eslint/eslint-plugin": "7.11.0",
22
- "@typescript-eslint/parser": "7.11.0",
35
+ "@eslint/compat": "1.1.0",
36
+ "@eslint/eslintrc": "3.1.0",
37
+ "@typescript-eslint/eslint-plugin": "7.13.1",
38
+ "@typescript-eslint/parser": "7.13.1",
23
39
  "eslint-config-airbnb": "19.0.4",
24
40
  "eslint-config-airbnb-typescript": "18.0.0",
25
41
  "eslint-config-prettier": "9.1.0",
26
- "eslint-plugin-deprecation": "2.0.0",
42
+ "eslint-plugin-deprecation": "3.0.0",
27
43
  "eslint-plugin-eslint-comments": "3.2.0",
28
44
  "eslint-plugin-import": "2.29.1",
29
- "eslint-plugin-jsx-a11y": "6.8.0",
30
- "eslint-plugin-react": "7.34.2",
45
+ "eslint-plugin-jsx-a11y": "6.9.0",
46
+ "eslint-plugin-react": "7.34.3",
31
47
  "eslint-plugin-react-hooks": "4.6.2"
32
48
  },
33
49
  "peerDependencies": {
34
- "eslint": ">= 8.5"
50
+ "eslint": ">= 9.4"
35
51
  },
36
52
  "devDependencies": {
37
- "eslint": "8.57.0",
53
+ "eslint": "9.5.0",
38
54
  "typescript": "5.4.5"
39
55
  }
40
56
  }
package/shared.mjs ADDED
@@ -0,0 +1,135 @@
1
+ import { fixupConfigRules } from '@eslint/compat'
2
+ import { FlatCompat } from '@eslint/eslintrc'
3
+ import path from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+
6
+ const filename = fileURLToPath(import.meta.url)
7
+ const dirname = path.dirname(filename)
8
+
9
+ const compat = new FlatCompat({
10
+ baseDirectory: dirname,
11
+ })
12
+
13
+ export default [
14
+ ...fixupConfigRules(
15
+ compat.extends(
16
+ 'airbnb/hooks',
17
+ 'prettier',
18
+ 'plugin:eslint-comments/recommended',
19
+ 'plugin:react/jsx-runtime',
20
+ ),
21
+ ),
22
+ {
23
+ rules: {
24
+ curly: 'error',
25
+
26
+ 'import/order': [
27
+ 'error',
28
+ {
29
+ alphabetize: {
30
+ caseInsensitive: false,
31
+ order: 'asc',
32
+ },
33
+
34
+ groups: [
35
+ ['builtin', 'external'],
36
+ 'internal',
37
+ 'parent',
38
+ 'sibling',
39
+ 'index',
40
+ ],
41
+ 'newlines-between': 'never',
42
+ },
43
+ ],
44
+
45
+ 'import/no-extraneous-dependencies': [
46
+ 'error',
47
+ {
48
+ devDependencies: [
49
+ '**/.jest/**',
50
+ '**/.storybook/**',
51
+ 'test/**',
52
+ 'tests/**',
53
+ 'spec/**',
54
+ '**/__tests__/**',
55
+ '**/__mocks__/**',
56
+ '**/__stories__/**',
57
+ 'test.{js,jsx,ts,tsx}',
58
+ 'test-*.{js,jsx,ts,tsx}',
59
+ '**/*{.,_}{test,spec}.{js,jsx,ts,tsx}',
60
+ '**/jest.config.{js,ts,mjs,mts}',
61
+ '**/jest.setup.{js,ts,mjs,mts}',
62
+ '**/webpack.config.{js,ts,mjs,mts}',
63
+ '**/webpack.config.*.{js,ts,mjs,mts}',
64
+ '**/rollup.config.{js,ts,mjs,mts}',
65
+ '**/rollup.config.*.{js,ts,mjs,mts}',
66
+ ],
67
+
68
+ optionalDependencies: false,
69
+ },
70
+ ],
71
+
72
+ 'import/prefer-default-export': 'off',
73
+
74
+ 'no-restricted-syntax': [
75
+ 'error',
76
+ {
77
+ message:
78
+ '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.',
79
+ selector: 'ForInStatement',
80
+ },
81
+ {
82
+ message:
83
+ 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
84
+ selector: 'LabeledStatement',
85
+ },
86
+ {
87
+ message:
88
+ '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
89
+ selector: 'WithStatement',
90
+ },
91
+ {
92
+ message: '`export *` is forbidden.',
93
+ selector: 'ExportAllDeclaration',
94
+ },
95
+ ],
96
+
97
+ 'padding-line-between-statements': [
98
+ 'error',
99
+ {
100
+ blankLine: 'always',
101
+ next: 'return',
102
+ prev: '*',
103
+ },
104
+ ],
105
+
106
+ 'react/function-component-definition': 'off',
107
+ 'react/no-adjacent-inline-elements': 'error',
108
+ 'prefer-object-has-own': 'error',
109
+ 'react/no-object-type-as-default-prop': 'error',
110
+ 'react/static-property-placement': ['error', 'static public field'],
111
+ 'react/state-in-constructor': ['error', 'never'],
112
+
113
+ 'react/sort-prop-types': [
114
+ 'error',
115
+ {
116
+ ignoreCase: true,
117
+ requiredFirst: false,
118
+ sortShapeProp: true,
119
+ },
120
+ ],
121
+
122
+ 'sort-imports': [
123
+ 'error',
124
+ {
125
+ ignoreDeclarationSort: true,
126
+ memberSyntaxSortOrder: ['single', 'multiple', 'all', 'none'],
127
+ },
128
+ ],
129
+
130
+ 'sort-keys': 'off',
131
+ 'no-constant-binary-expression': 'error',
132
+ 'react/jsx-key': 'error',
133
+ },
134
+ },
135
+ ]
package/typescript.mjs ADDED
@@ -0,0 +1,77 @@
1
+ import { fixupConfigRules } from '@eslint/compat'
2
+ import { FlatCompat } from '@eslint/eslintrc'
3
+ import deprecation from 'eslint-plugin-deprecation'
4
+ import path from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+ import shared from './shared.mjs'
7
+
8
+ const filename = fileURLToPath(import.meta.url)
9
+ const dirname = path.dirname(filename)
10
+
11
+ const compat = new FlatCompat({
12
+ baseDirectory: dirname,
13
+ })
14
+
15
+ export default [
16
+ ...fixupConfigRules(
17
+ compat.extends(
18
+ 'eslint-config-airbnb',
19
+ 'eslint-config-airbnb-typescript',
20
+ 'plugin:@typescript-eslint/recommended',
21
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
22
+ ),
23
+ ),
24
+ ...shared,
25
+ {
26
+ plugins: {
27
+ deprecation,
28
+ },
29
+
30
+ rules: {
31
+ '@typescript-eslint/array-type': [
32
+ 'error',
33
+ {
34
+ default: 'array',
35
+ },
36
+ ],
37
+
38
+ '@typescript-eslint/no-base-to-string': 'error',
39
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
40
+ '@typescript-eslint/no-unnecessary-condition': 'error',
41
+ '@typescript-eslint/no-unnecessary-type-arguments': 'error',
42
+ '@typescript-eslint/no-unsafe-declaration-merging': 'error',
43
+ '@typescript-eslint/prefer-for-of': 'error',
44
+ '@typescript-eslint/prefer-includes': 'error',
45
+ '@typescript-eslint/prefer-optional-chain': 'error',
46
+ '@typescript-eslint/prefer-reduce-type-parameter': 'error',
47
+ '@typescript-eslint/prefer-string-starts-ends-with': 'error',
48
+ '@typescript-eslint/prefer-ts-expect-error': 'error',
49
+ '@typescript-eslint/no-floating-promises': 'error',
50
+
51
+ '@typescript-eslint/no-misused-promises': [
52
+ 'error',
53
+ {
54
+ checksVoidReturn: {
55
+ attributes: false,
56
+ },
57
+ },
58
+ ],
59
+
60
+ '@typescript-eslint/no-explicit-any': 'warn',
61
+ '@typescript-eslint/no-unused-vars': 'error',
62
+ '@typescript-eslint/consistent-type-imports': 'error',
63
+ '@typescript-eslint/consistent-type-exports': 'error',
64
+ '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
65
+ '@typescript-eslint/no-redundant-type-constituents': 'warn',
66
+ 'react/require-default-props': 'off',
67
+ 'react/prop-types': 'off',
68
+
69
+ 'react/jsx-no-useless-fragment': [
70
+ 'error',
71
+ {
72
+ allowExpressions: true,
73
+ },
74
+ ],
75
+ },
76
+ },
77
+ ]