@wistia/eslint-config 1.0.0 → 1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @wistia/eslint-config
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#397](https://github.com/wistia/eslint-config/pull/397) [`92ddfaa`](https://github.com/wistia/eslint-config/commit/92ddfaaf2085586ddcee24fe98063f2c826d1f15) Thanks [@okize](https://github.com/okize)! - feat: add rules relating to barrel-file management
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#395](https://github.com/wistia/eslint-config/pull/395) [`48f88a3`](https://github.com/wistia/eslint-config/commit/48f88a3e297a617a02c487276907115c180d0960) Thanks [@okize](https://github.com/okize)! - fix: add `global` to vitest to avoid "no-undef" errors
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  ### Major Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/eslint-config",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Wistia's ESLint configurations",
5
5
  "packageManager": "yarn@4.9.2",
6
6
  "type": "module",
@@ -47,6 +47,7 @@
47
47
  "@typescript-eslint/parser": "^8.48.1",
48
48
  "confusing-browser-globals": "^1.0.11",
49
49
  "eslint-import-resolver-typescript": "^4.4.4",
50
+ "eslint-plugin-barrel-files": "^3.0.1",
50
51
  "eslint-plugin-filenames": "^1.3.2",
51
52
  "eslint-plugin-import": "^2.32.0",
52
53
  "eslint-plugin-jest": "^29.2.1",
@@ -5,6 +5,7 @@ import jsPlugin from '@eslint/js';
5
5
  import stylisticPlugin from '@stylistic/eslint-plugin';
6
6
  import filenamesPlugin from 'eslint-plugin-filenames';
7
7
  import importPlugin from 'eslint-plugin-import';
8
+ import barrelFilesPlugin from 'eslint-plugin-barrel-files';
8
9
  import prettierPlugin from 'eslint-plugin-prettier';
9
10
  import promisePlugin from 'eslint-plugin-promise';
10
11
  import baseRules from '../rules/base.mjs';
@@ -12,6 +13,7 @@ import stylisticRules from '../rules/stylistic.mjs';
12
13
  import promiseRules from '../rules/promise.mjs';
13
14
  import filenameRules from '../rules/filenames.mjs';
14
15
  import importRules from '../rules/import.mjs';
16
+ import barrelFilesRules from '../rules/barrel-files.mjs';
15
17
 
16
18
  export default [
17
19
  {
@@ -33,16 +35,18 @@ export default [
33
35
  'import/extensions': ['.js', '.jsx', '.mjs', '.cjs'],
34
36
  },
35
37
  plugins: {
36
- js: jsPlugin,
37
38
  '@stylistic': stylisticPlugin,
39
+ 'barrel-files': barrelFilesPlugin,
38
40
  filenames: fixupPluginRules(filenamesPlugin),
39
41
  import: importPlugin,
42
+ js: jsPlugin,
40
43
  prettier: prettierPlugin,
41
44
  promise: promisePlugin,
42
45
  },
43
46
  rules: {
44
47
  ...baseRules,
45
48
  ...stylisticRules,
49
+ ...barrelFilesRules,
46
50
  ...filenameRules,
47
51
  ...importRules,
48
52
  ...promiseRules,
@@ -5,6 +5,7 @@ import { fixupPluginRules } from '@eslint/compat';
5
5
  import stylisticPlugin from '@stylistic/eslint-plugin';
6
6
  import filenamesPlugin from 'eslint-plugin-filenames';
7
7
  import importPlugin from 'eslint-plugin-import';
8
+ import barrelFilesPlugin from 'eslint-plugin-barrel-files';
8
9
  import prettierPlugin from 'eslint-plugin-prettier';
9
10
  import promisePlugin from 'eslint-plugin-promise';
10
11
  import baseRules from '../rules/base.mjs';
@@ -13,6 +14,7 @@ import promiseRules from '../rules/promise.mjs';
13
14
  import filenameRules from '../rules/filenames.mjs';
14
15
  import importRules from '../rules/import.mjs';
15
16
  import typescriptRules from '../rules/typescript.mjs';
17
+ import barrelFilesRules from '../rules/barrel-files.mjs';
16
18
 
17
19
  export default [
18
20
  {
@@ -31,8 +33,9 @@ export default [
31
33
  },
32
34
  },
33
35
  plugins: {
34
- '@typescript-eslint': typescriptPlugin,
35
36
  '@stylistic': stylisticPlugin,
37
+ '@typescript-eslint': typescriptPlugin,
38
+ 'barrel-files': barrelFilesPlugin,
36
39
  filenames: fixupPluginRules(filenamesPlugin),
37
40
  import: importPlugin,
38
41
  prettier: prettierPlugin,
@@ -67,6 +70,7 @@ export default [
67
70
  rules: {
68
71
  ...baseRules,
69
72
  ...stylisticRules,
73
+ ...barrelFilesRules,
70
74
  ...filenameRules,
71
75
  ...importRules,
72
76
  ...promiseRules,
@@ -10,6 +10,8 @@ export default [
10
10
  languageOptions: {
11
11
  globals: {
12
12
  ...globalsVitest,
13
+ // needed to avoid "no-undef" errors in vitest test files
14
+ global: 'readonly',
13
15
  },
14
16
  },
15
17
  plugins: {
@@ -0,0 +1,20 @@
1
+ // only add rules related to barrel files
2
+ // see: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7/
3
+
4
+ export default {
5
+ // Avoid barrel files
6
+ // https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-barrel-files.md
7
+ 'barrel-files/avoid-barrel-files': 'off',
8
+
9
+ // Avoid importing barrel files
10
+ // https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-importing-barrel-files.md
11
+ 'barrel-files/avoid-importing-barrel-files': 'off',
12
+
13
+ // Avoid namespace imports from barrel files
14
+ // https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-namespace-import.md
15
+ 'barrel-files/avoid-namespace-import': 'off',
16
+
17
+ // Avoid re-export all from barrel files
18
+ // https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-re-export-all.md
19
+ 'barrel-files/avoid-re-export-all': 'error',
20
+ };
@@ -75,10 +75,11 @@
75
75
  },
76
76
  "plugins": [
77
77
  "@",
78
- "js:@eslint/js@9.39.1",
79
78
  "@stylistic",
79
+ "barrel-files:eslint-plugin-barrel-files@3.0.1",
80
80
  "filenames",
81
81
  "import",
82
+ "js:@eslint/js@9.39.1",
82
83
  "prettier:eslint-plugin-prettier@5.5.4",
83
84
  "promise",
84
85
  ],
@@ -421,6 +422,18 @@
421
422
  0,
422
423
  "as-needed",
423
424
  ],
425
+ "barrel-files/avoid-barrel-files": [
426
+ 0,
427
+ ],
428
+ "barrel-files/avoid-importing-barrel-files": [
429
+ 0,
430
+ ],
431
+ "barrel-files/avoid-namespace-import": [
432
+ 0,
433
+ ],
434
+ "barrel-files/avoid-re-export-all": [
435
+ 2,
436
+ ],
424
437
  "block-scoped-var": [
425
438
  2,
426
439
  ],
@@ -77,8 +77,9 @@
77
77
  },
78
78
  "plugins": [
79
79
  "@",
80
- "@typescript-eslint:@typescript-eslint/eslint-plugin@8.48.1",
81
80
  "@stylistic",
81
+ "@typescript-eslint:@typescript-eslint/eslint-plugin@8.48.1",
82
+ "barrel-files:eslint-plugin-barrel-files@3.0.1",
82
83
  "filenames",
83
84
  "import",
84
85
  "prettier:eslint-plugin-prettier@5.5.4",
@@ -893,6 +894,18 @@
893
894
  0,
894
895
  "as-needed",
895
896
  ],
897
+ "barrel-files/avoid-barrel-files": [
898
+ 0,
899
+ ],
900
+ "barrel-files/avoid-importing-barrel-files": [
901
+ 0,
902
+ ],
903
+ "barrel-files/avoid-namespace-import": [
904
+ 0,
905
+ ],
906
+ "barrel-files/avoid-re-export-all": [
907
+ 2,
908
+ ],
896
909
  "block-scoped-var": [
897
910
  2,
898
911
  ],
@@ -13,6 +13,7 @@
13
13
  "describe": true,
14
14
  "expect": true,
15
15
  "expectTypeOf": true,
16
+ "global": "readonly",
16
17
  "it": true,
17
18
  "onTestFailed": true,
18
19
  "onTestFinished": true,