eslint-config-seek 10.1.3 → 10.3.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.
@@ -76,40 +76,26 @@ const baseRules = {
76
76
  'no-return-await': OFF,
77
77
  };
78
78
 
79
- const reactRules = {
80
- 'react/prefer-es6-class': [ERROR, 'always'],
81
- 'react/self-closing-comp': ERROR,
82
- 'react/jsx-pascal-case': ERROR,
83
- 'react-hooks/rules-of-hooks': ERROR,
84
- 'react-hooks/exhaustive-deps': ERROR,
85
- 'react/no-children-prop': ERROR,
86
- 'react/display-name': OFF,
87
- 'react/prop-types': OFF,
88
- };
79
+ const jsExtensions = ['js', 'cjs', 'mjs', 'jsx'];
80
+ const tsExtensions = ['ts', 'cts', 'mts', 'tsx'];
81
+ const allExtensions = [...jsExtensions, ...tsExtensions];
89
82
 
90
83
  /** @type {import('eslint').Linter.Config} */
91
84
  const baseConfig = {
92
85
  parser: '@babel/eslint-parser',
93
86
  parserOptions: {
87
+ requireConfigFile: false,
88
+ sourceType: 'module',
94
89
  babelOptions: {
95
90
  presets: ['@babel/preset-react'],
96
91
  },
97
- requireConfigFile: false,
98
- sourceType: 'module',
99
92
  },
100
93
  root: true,
101
94
  env: {
102
- browser: true,
103
95
  node: true,
104
96
  },
105
- settings: {
106
- react: {
107
- version: 'detect',
108
- },
109
- },
110
- plugins: ['react', 'react-hooks', 'import'],
97
+ plugins: ['import'],
111
98
  extends: [
112
- 'plugin:react/recommended',
113
99
  // this config enables eslint-plugin-import to resolve JavaScript and TypeScript files
114
100
  // https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/config/typescript.js
115
101
  // Some rules provided by eslint-plugin-import e.g. `import/no-duplicates` don't work without it
@@ -118,12 +104,11 @@ const baseConfig = {
118
104
  ],
119
105
  rules: {
120
106
  ...baseRules,
121
- ...reactRules,
122
107
  },
123
108
  overrides: [
124
109
  {
125
110
  // TypeScript config
126
- files: ['**/*.ts', '**/*.tsx'],
111
+ files: [`**/*.{${tsExtensions}}`],
127
112
  parser: '@typescript-eslint/parser',
128
113
  parserOptions: {
129
114
  ecmaVersion: 2018,
@@ -170,7 +155,7 @@ const baseConfig = {
170
155
  },
171
156
  {
172
157
  // JavaScript config
173
- files: ['**/*.js', '**/*.jsx'],
158
+ files: [`**/*.{${jsExtensions}}`],
174
159
  env: {
175
160
  es6: true,
176
161
  },
@@ -195,7 +180,10 @@ const baseConfig = {
195
180
  },
196
181
  {
197
182
  // Jest config
198
- files: ['**/__tests__/**/*.{js,ts,tsx}', '**/*.@(spec|test).{js,ts,tsx}'],
183
+ files: [
184
+ `**/__tests__/**/*.{${allExtensions}}`,
185
+ `**/*.@(spec|test).{${allExtensions}}`,
186
+ ],
199
187
  env: {
200
188
  jest: true,
201
189
  },
@@ -204,7 +192,7 @@ const baseConfig = {
204
192
  },
205
193
  {
206
194
  // Cypress config
207
- files: ['**/cypress/**/*.{js,ts,tsx}'],
195
+ files: [`**/cypress/**/*.{${allExtensions}}`],
208
196
  env: {
209
197
  'cypress/globals': true,
210
198
  },
package/index.js ADDED
@@ -0,0 +1,32 @@
1
+ const OFF = 0;
2
+ const ERROR = 2;
3
+
4
+ const reactRules = {
5
+ 'react/prefer-es6-class': [ERROR, 'always'],
6
+ 'react/self-closing-comp': ERROR,
7
+ 'react/jsx-pascal-case': ERROR,
8
+ 'react-hooks/rules-of-hooks': ERROR,
9
+ 'react-hooks/exhaustive-deps': ERROR,
10
+ 'react/no-children-prop': ERROR,
11
+ 'react/display-name': OFF,
12
+ 'react/prop-types': OFF,
13
+ };
14
+
15
+ /** @type {import('eslint').Linter.Config} */
16
+ const eslintConfig = {
17
+ env: {
18
+ browser: true,
19
+ },
20
+ settings: {
21
+ react: {
22
+ version: 'detect',
23
+ },
24
+ },
25
+ plugins: ['react', 'react-hooks'],
26
+ extends: ['plugin:react/recommended', './base.js'],
27
+ rules: {
28
+ ...reactRules,
29
+ },
30
+ };
31
+
32
+ module.exports = eslintConfig;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "eslint-config-seek",
3
- "version": "10.1.3",
3
+ "version": "10.3.0",
4
4
  "description": "ESLint configuration used by SEEK",
5
- "main": ".eslintrc.js",
5
+ "main": "index.js",
6
6
  "files": [
7
- ".eslintrc.js"
7
+ "index.js",
8
+ "base.js"
8
9
  ],
9
10
  "repository": {
10
11
  "type": "git",
@@ -17,38 +18,38 @@
17
18
  },
18
19
  "homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
19
20
  "dependencies": {
20
- "@babel/core": "^7.20.7",
21
+ "@babel/core": "^7.21.0",
21
22
  "@babel/eslint-parser": "^7.19.1",
22
23
  "@babel/preset-react": "^7.18.6",
23
- "@typescript-eslint/eslint-plugin": "^5.48.0",
24
- "@typescript-eslint/parser": "^5.48.0",
24
+ "@typescript-eslint/eslint-plugin": "^5.53.0",
25
+ "@typescript-eslint/parser": "^5.53.0",
25
26
  "eslint-config-prettier": "^8.6.0",
26
- "eslint-import-resolver-typescript": "3.5.2",
27
+ "eslint-import-resolver-typescript": "3.5.3",
27
28
  "eslint-plugin-cypress": "^2.12.1",
28
- "eslint-plugin-import": "^2.26.0",
29
- "eslint-plugin-jest": "^27.2.0",
30
- "eslint-plugin-react": "^7.31.11",
29
+ "eslint-plugin-import": "^2.27.5",
30
+ "eslint-plugin-jest": "^27.2.1",
31
+ "eslint-plugin-react": "^7.32.2",
31
32
  "eslint-plugin-react-hooks": "^4.6.0",
32
33
  "find-root": "^1.1.0"
33
34
  },
34
35
  "devDependencies": {
35
- "@changesets/cli": "2.25.0",
36
- "@changesets/get-github-info": "0.5.1",
37
- "eslint": "8.26.0",
38
- "prettier": "2.7.1",
39
- "typescript": "^4.9.4"
36
+ "@changesets/cli": "^2.26.0",
37
+ "@changesets/get-github-info": "^0.5.2",
38
+ "eslint": "^8.34.0",
39
+ "prettier": "^2.8.4",
40
+ "typescript": "~4.9.5"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "eslint": ">=6",
43
44
  "typescript": ">=3.3"
44
45
  },
45
- "packageManager": "pnpm@7.14.0",
46
+ "packageManager": "pnpm@7.27.1",
46
47
  "volta": {
47
- "node": "16.18.0"
48
+ "node": "16.19.1"
48
49
  },
49
50
  "scripts": {
50
51
  "release": "changeset publish",
51
- "test": "eslint .",
52
+ "test": "eslint --config index.js . && eslint --config base.js .",
52
53
  "changeset-version": "changeset version && prettier --write ."
53
54
  }
54
55
  }