eslint-config-adslot 2.0.2 → 2.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.
Files changed (2) hide show
  1. package/index.js +46 -53
  2. package/package.json +11 -11
package/index.js CHANGED
@@ -1,33 +1,27 @@
1
- // The ESLint browser environment defines all browser globals as valid,
2
- // even though most people don't know some of them exist (e.g. `name` or `status`).
3
- // This is dangerous as it hides accidentally undefined variables.
4
- // We blacklist the globals that we deem potentially confusing.
5
- // To use them, explicitly reference them, e.g. `window.name` or `window.status`.
6
- const restrictedGlobals = require('confusing-browser-globals');
7
- const eslintConfigPrettier = require('eslint-config-prettier');
8
- const eslintPluginImport = require('eslint-plugin-import');
9
- const eslintPluginJsxA11y = require('eslint-plugin-jsx-a11y');
10
- const eslintPluginReact = require('eslint-plugin-react');
11
- const eslintPluginReactHooks = require('eslint-plugin-react-hooks');
12
- const eslintPluginLodash = require('eslint-plugin-lodash');
13
- const eslintPluginChaiFriendly = require('eslint-plugin-chai-friendly');
14
- const eslintPluginJest = require('eslint-plugin-jest');
15
- const eslintPluginNoSnapshotTesting = require('eslint-plugin-no-snapshot-testing');
16
- const eslintPluginTypescript = require('@typescript-eslint/eslint-plugin');
17
- const globals = require('globals');
1
+ import { defineConfig } from 'eslint/config';
2
+ import eslintConfigPrettier from 'eslint-config-prettier';
3
+ import eslintPluginImport from 'eslint-plugin-import';
4
+ import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y';
5
+ import eslintPluginReact from 'eslint-plugin-react';
6
+ import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
7
+ import eslintPluginLodash from 'eslint-plugin-lodash';
8
+ import eslintPluginChaiFriendly from 'eslint-plugin-chai-friendly';
9
+ import eslintPluginJest from 'eslint-plugin-jest';
10
+ import eslintPluginNoSnapshotTesting from 'eslint-plugin-no-snapshot-testing';
11
+ import eslintTypescriptParser from '@typescript-eslint/parser';
12
+ import eslintPluginTypescript from '@typescript-eslint/eslint-plugin';
13
+ import globals from 'globals';
18
14
 
19
- module.exports = [
15
+ export default defineConfig([
20
16
  eslintConfigPrettier,
21
17
  {
22
- files: ['**/*.js?(x)', '**/*.?(c|m)js', '**/*.ts?(x)'],
18
+ files: ['**/*.{js,jsx,cjs,mjs,ts,tsx}'],
23
19
  languageOptions: {
24
20
  globals: {
25
21
  ...globals.browser,
26
22
  ...globals.commonjs,
27
- ...globals.es2021,
28
- ...globals.jest,
29
23
  ...globals.node,
30
- ...globals.mocha,
24
+ ...globals.es2021,
31
25
  },
32
26
  ecmaVersion: 'latest',
33
27
  sourceType: 'module',
@@ -44,22 +38,19 @@ module.exports = [
44
38
  },
45
39
  'import/resolver': {
46
40
  node: {
47
- extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'],
41
+ extensions: ['.ts', '.tsx', '.cjs', '.js', '.jsx', '.mjs'],
48
42
  },
49
43
  },
50
44
  },
51
45
  plugins: {
52
- 'import': eslintPluginImport,
46
+ import: eslintPluginImport,
53
47
  'jsx-a11y': eslintPluginJsxA11y,
54
- 'react': eslintPluginReact,
48
+ react: eslintPluginReact,
55
49
  'react-hooks': eslintPluginReactHooks,
56
- 'lodash': eslintPluginLodash,
50
+ lodash: eslintPluginLodash,
57
51
  'chai-friendly': eslintPluginChaiFriendly,
58
- 'jest': eslintPluginJest,
59
- 'no-snapshot-testing': eslintPluginNoSnapshotTesting,
60
52
  },
61
- // NOTE: When adding rules here, you need to make sure they are compatible with
62
- // `typescript-eslint`, as some rules such as `no-array-constructor` aren't compatible.
53
+
63
54
  rules: {
64
55
  // http://eslint.org/docs/rules/
65
56
  'array-callback-return': 'error',
@@ -114,7 +105,6 @@ module.exports = [
114
105
  'no-this-before-super': 'error',
115
106
  'no-throw-literal': 'error',
116
107
  'no-undef': 'error',
117
- 'no-restricted-globals': ['error'].concat(restrictedGlobals),
118
108
  'no-unreachable': 'error',
119
109
  'no-shadow': ['error', { allow: ['cb', 'err', 'done', 'next'] }],
120
110
  'no-console': 'error',
@@ -240,7 +230,6 @@ module.exports = [
240
230
  'react/no-access-state-in-setstate': 'error',
241
231
 
242
232
  // https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
243
- 'jsx-a11y/accessible-emoji': 'error',
244
233
  'jsx-a11y/alt-text': 'error',
245
234
  'jsx-a11y/anchor-has-content': 'error',
246
235
  'jsx-a11y/anchor-is-valid': [
@@ -278,28 +267,14 @@ module.exports = [
278
267
  'lodash/chain-style': ['error', 'as-needed'],
279
268
  'lodash/chaining': ['error', 'always'],
280
269
  'lodash/path-style': ['error', 'string'],
281
-
282
- // https://github.com/jest-community/eslint-plugin-jest
283
- // could also be used in non-jest tests
284
- 'jest/no-disabled-tests': 'error',
285
- 'jest/no-focused-tests': 'error',
286
-
287
- 'no-snapshot-testing/no-snapshot-testing': 'error',
288
270
  },
289
271
  },
290
272
  {
291
273
  files: ['**/*.ts?(x)'],
292
274
  languageOptions: {
293
- ecmaVersion: 2018,
275
+ ecmaVersion: 'latest',
294
276
  sourceType: 'module',
295
- parser: '@typescript-eslint/parser',
296
- parserOptions: {
297
- ecmaFeatures: {
298
- jsx: true,
299
- },
300
- // typescript-eslint specific options
301
- warnOnUnsupportedTypeScriptVersion: true,
302
- },
277
+ parser: eslintTypescriptParser,
303
278
  },
304
279
  plugins: {
305
280
  '@typescript-eslint': eslintPluginTypescript,
@@ -317,9 +292,7 @@ module.exports = [
317
292
 
318
293
  // Add TypeScript specific rules (and turn off ESLint equivalents)
319
294
  '@typescript-eslint/consistent-type-assertions': 'error',
320
- 'no-array-constructor': 'off',
321
- '@typescript-eslint/no-array-constructor': 'error',
322
- '@typescript-eslint/no-namespace': 'error',
295
+
323
296
  'no-use-before-define': 'off',
324
297
  '@typescript-eslint/no-use-before-define': [
325
298
  'error',
@@ -330,6 +303,7 @@ module.exports = [
330
303
  typedefs: false,
331
304
  },
332
305
  ],
306
+
333
307
  'no-unused-vars': 'off',
334
308
  '@typescript-eslint/no-unused-vars': [
335
309
  'error',
@@ -339,9 +313,28 @@ module.exports = [
339
313
  caughtErrors: 'none',
340
314
  },
341
315
  ],
316
+
342
317
  'no-useless-constructor': 'off',
343
318
  '@typescript-eslint/no-useless-constructor': 'error',
344
- '@typescript-eslint/no-explicit-any': 'error',
319
+
320
+ '@typescript-eslint/ban-ts-comment': 'off',
321
+ },
322
+ },
323
+ {
324
+ files: ['**/*.{spec,test}.{ts,tsx,js,jsx}'],
325
+ ...eslintPluginJest.configs['flat/recommended'],
326
+ plugins: {
327
+ 'no-snapshot-testing': eslintPluginNoSnapshotTesting,
328
+ jest: eslintPluginJest,
329
+ },
330
+ rules: {
331
+ '@typescript-eslint/no-explicit-any': 'off',
332
+ 'no-snapshot-testing/no-snapshot-testing': 'error',
333
+
334
+ // https://github.com/jest-community/eslint-plugin-jest
335
+ // could also be used in non-jest tests
336
+ 'jest/no-disabled-tests': 'error',
337
+ 'jest/no-focused-tests': 'error',
345
338
  },
346
339
  },
347
- ];
340
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-adslot",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "ESLint configuration for Adslot",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -14,6 +14,7 @@
14
14
  "engines": {
15
15
  "node": "^22"
16
16
  },
17
+ "type": "module",
17
18
  "keywords": [
18
19
  "ESLint",
19
20
  "eslint-config-adslot"
@@ -24,6 +25,7 @@
24
25
  },
25
26
  "homepage": "https://github.com/Adslot/eslint-config-adslot#readme",
26
27
  "scripts": {
28
+ "test": "eslint index.js -c index.js --rule 'import/no-unresolved: off'",
27
29
  "postversion": "git push -u origin $(git rev-parse --abbrev-ref HEAD) --follow-tags && npm publish && echo '…released.'",
28
30
  "preversion": "echo 'Releasing…' && npm ci",
29
31
  "release:major": "npm version major -m 'build: release major version %s'",
@@ -31,20 +33,18 @@
31
33
  "release:patch": "npm version patch -m 'build: release patch version %s'"
32
34
  },
33
35
  "dependencies": {
34
- "@typescript-eslint/eslint-plugin": "^8.21.0",
35
- "@typescript-eslint/parser": "^8.21.0",
36
- "confusing-browser-globals": "^1.0.11",
37
- "eslint-config-prettier": "^10.0.1",
38
- "eslint-plugin-chai-friendly": "^1.0.1",
39
- "eslint-plugin-import": "^2.31.0",
40
- "eslint-plugin-jest": "^28.11.0",
36
+ "eslint-config-prettier": "^10.1.5",
37
+ "eslint-plugin-chai-friendly": "^1.1.0",
38
+ "eslint-plugin-import": "^2.32.0",
39
+ "eslint-plugin-jest": "^29.0.1",
41
40
  "eslint-plugin-jsx-a11y": "^6.10.2",
42
41
  "eslint-plugin-lodash": "^8.0.0",
43
42
  "eslint-plugin-no-snapshot-testing": "^1.0.61",
44
- "eslint-plugin-react": "^7.37.4",
45
- "eslint-plugin-react-hooks": "^5.1.0"
43
+ "eslint-plugin-react": "^7.37.5",
44
+ "eslint-plugin-react-hooks": "^5.2.0",
45
+ "typescript-eslint": "^8.36.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "eslint": "^9.18.0"
48
+ "eslint": "^9.31.0"
49
49
  }
50
50
  }