@websolutespa/eslint-config 3.1.0 → 3.1.2

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,9 @@
1
1
  # @websolutespa/eslint-config
2
2
 
3
+ ## 3.1.2
4
+
5
+ ## 3.1.1
6
+
3
7
  ## 3.1.0
4
8
 
5
9
  ### Minor Changes
package/base.js CHANGED
@@ -1,115 +1,115 @@
1
- import js from '@eslint/js';
2
- import stylistic from '@stylistic/eslint-plugin';
3
- import prettier from 'eslint-config-prettier';
4
- import onlyWarn from 'eslint-plugin-only-warn';
5
- import turbo from 'eslint-plugin-turbo';
6
- import typescript from 'typescript-eslint';
7
-
8
- /**
9
- * A shared ESLint configuration for the repository.
10
- *
11
- * @type {import("eslint").Linter.Config[]}
12
- * */
13
- export const base = [
14
- js.configs.recommended,
15
- prettier,
16
- ...typescript.configs.recommended,
17
- /*
18
- {
19
- rules: [
20
- ...typescript.configs.recommended.rules,
21
- ...typescript.configs['recommended-requiring-type-checking'].rules,
22
- ]
23
- },
24
- */
25
- {
26
- plugins: {
27
- turbo,
28
- },
29
- rules: {
30
- 'turbo/no-undeclared-env-vars': 'warn',
31
- },
32
- },
33
- {
34
- plugins: {
35
- onlyWarn,
36
- },
37
- },
38
- {
39
- // Helpers must not read request data: only the template (page, layout,
40
- // route handler) reads headers()/cookies()/draftMode() and passes it down.
41
- rules: {
42
- 'no-restricted-imports': ['warn', {
43
- paths: [{
44
- name: 'next/headers',
45
- message: 'Read request data (headers, cookies, draftMode) in the template under src/app and pass it down as an argument.',
46
- }],
47
- }],
48
- },
49
- },
50
- {
51
- files: [
52
- 'src/app/**',
53
- '**/handlers/**',
54
- '**/*.test.{ts,tsx}',
55
- ],
56
- rules: {
57
- 'no-restricted-imports': 'off',
58
- },
59
- },
60
- {
61
- ignores: [
62
- '**/.next/**',
63
- '**/.rollup.cache/**',
64
- '**/.turbo/**',
65
- '**/build/**',
66
- '**/dist/**',
67
- 'src/app/(payload)/**',
68
- ],
69
- },
70
- {
71
- plugins: { '@stylistic': stylistic },
72
- rules: {
73
- '@stylistic/quotes': ['error', 'single'],
74
- '@stylistic/comma-dangle': ['warn', {
75
- 'arrays': 'always-multiline',
76
- 'objects': 'always-multiline',
77
- 'imports': 'never',
78
- 'exports': 'never',
79
- 'functions': 'never',
80
- }],
81
- 'for-direction': 'off',
82
- '@stylistic/indent': ['error', 2, {
83
- 'SwitchCase': 1,
84
- }],
85
- '@stylistic/jsx-quotes': ['error', 'prefer-double'],
86
- 'no-cond-assign': ['error', 'always'],
87
- 'no-empty-function': 'off',
88
- 'no-empty': 'warn',
89
- '@stylistic/no-extra-semi': 'error',
90
- '@stylistic/no-multi-spaces': 'error',
91
- 'no-unreachable': 'error',
92
- 'no-unused-vars': 'off',
93
- '@stylistic/semi': 'error',
94
- },
95
- }, {
96
- files: [
97
- '*.{ts,tsx}',
98
- ],
99
- rules: {
100
- '@typescript-eslint/ban-types': 'off',
101
- '@typescript-eslint/explicit-module-boundary-types': 'off',
102
- '@typescript-eslint/no-empty-function': 'off',
103
- '@typescript-eslint/no-empty-interface': 'off',
104
- '@typescript-eslint/no-explicit-any': 'warn',
105
- '@typescript-eslint/no-inferrable-types': 'off',
106
- '@typescript-eslint/no-unused-vars': 'warn',
107
- '@typescript-eslint/no-use-before-define': ['error', {
108
- 'functions': false,
109
- 'classes': false,
110
- 'variables': true,
111
- 'allowNamedExports': false,
112
- }],
113
- },
114
- },
115
- ];
1
+ import js from '@eslint/js';
2
+ import stylistic from '@stylistic/eslint-plugin';
3
+ import prettier from 'eslint-config-prettier';
4
+ import onlyWarn from 'eslint-plugin-only-warn';
5
+ import turbo from 'eslint-plugin-turbo';
6
+ import typescript from 'typescript-eslint';
7
+
8
+ /**
9
+ * A shared ESLint configuration for the repository.
10
+ *
11
+ * @type {import("eslint").Linter.Config[]}
12
+ * */
13
+ export const base = [
14
+ js.configs.recommended,
15
+ prettier,
16
+ ...typescript.configs.recommended,
17
+ /*
18
+ {
19
+ rules: [
20
+ ...typescript.configs.recommended.rules,
21
+ ...typescript.configs['recommended-requiring-type-checking'].rules,
22
+ ]
23
+ },
24
+ */
25
+ {
26
+ plugins: {
27
+ turbo,
28
+ },
29
+ rules: {
30
+ 'turbo/no-undeclared-env-vars': 'warn',
31
+ },
32
+ },
33
+ {
34
+ plugins: {
35
+ onlyWarn,
36
+ },
37
+ },
38
+ {
39
+ // Helpers must not read request data: only the template (page, layout,
40
+ // route handler) reads headers()/cookies()/draftMode() and passes it down.
41
+ rules: {
42
+ 'no-restricted-imports': ['warn', {
43
+ paths: [{
44
+ name: 'next/headers',
45
+ message: 'Read request data (headers, cookies, draftMode) in the template under src/app and pass it down as an argument.',
46
+ }],
47
+ }],
48
+ },
49
+ },
50
+ {
51
+ files: [
52
+ 'src/app/**',
53
+ '**/handlers/**',
54
+ '**/*.test.{ts,tsx}',
55
+ ],
56
+ rules: {
57
+ 'no-restricted-imports': 'off',
58
+ },
59
+ },
60
+ {
61
+ ignores: [
62
+ '**/.next/**',
63
+ '**/.rollup.cache/**',
64
+ '**/.turbo/**',
65
+ '**/build/**',
66
+ '**/dist/**',
67
+ 'src/app/(payload)/**',
68
+ ],
69
+ },
70
+ {
71
+ plugins: { '@stylistic': stylistic },
72
+ rules: {
73
+ '@stylistic/quotes': ['error', 'single'],
74
+ '@stylistic/comma-dangle': ['warn', {
75
+ 'arrays': 'always-multiline',
76
+ 'objects': 'always-multiline',
77
+ 'imports': 'never',
78
+ 'exports': 'never',
79
+ 'functions': 'never',
80
+ }],
81
+ 'for-direction': 'off',
82
+ '@stylistic/indent': ['error', 2, {
83
+ 'SwitchCase': 1,
84
+ }],
85
+ '@stylistic/jsx-quotes': ['error', 'prefer-double'],
86
+ 'no-cond-assign': ['error', 'always'],
87
+ 'no-empty-function': 'off',
88
+ 'no-empty': 'warn',
89
+ '@stylistic/no-extra-semi': 'error',
90
+ '@stylistic/no-multi-spaces': 'error',
91
+ 'no-unreachable': 'error',
92
+ 'no-unused-vars': 'off',
93
+ '@stylistic/semi': 'error',
94
+ },
95
+ }, {
96
+ files: [
97
+ '*.{ts,tsx}',
98
+ ],
99
+ rules: {
100
+ '@typescript-eslint/ban-types': 'off',
101
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
102
+ '@typescript-eslint/no-empty-function': 'off',
103
+ '@typescript-eslint/no-empty-interface': 'off',
104
+ '@typescript-eslint/no-explicit-any': 'warn',
105
+ '@typescript-eslint/no-inferrable-types': 'off',
106
+ '@typescript-eslint/no-unused-vars': 'warn',
107
+ '@typescript-eslint/no-use-before-define': ['error', {
108
+ 'functions': false,
109
+ 'classes': false,
110
+ 'variables': true,
111
+ 'allowNamedExports': false,
112
+ }],
113
+ },
114
+ },
115
+ ];
package/next.js CHANGED
@@ -1,79 +1,79 @@
1
- import nextPlugin from '@next/eslint-plugin-next';
2
- import { fixupPluginRules } from '@eslint/compat';
3
- import reactPluginSource from 'eslint-plugin-react';
4
- import reactHooks from 'eslint-plugin-react-hooks';
5
- import globals from 'globals';
6
- import { base } from './base.js';
7
-
8
- // eslint-plugin-react uses context methods removed in eslint 10
9
- const reactPlugin = fixupPluginRules(reactPluginSource);
10
- const reactRecommended = {
11
- ...reactPluginSource.configs.flat.recommended,
12
- plugins: { react: reactPlugin },
13
- };
14
-
15
- /**
16
- * A custom ESLint configuration for libraries that use Next.js.
17
- *
18
- * @type {import("eslint").Linter.Config[]}
19
- * */
20
- export const next = [
21
- ...base,
22
- {
23
- ...reactRecommended,
24
- languageOptions: {
25
- ...reactRecommended.languageOptions,
26
- globals: {
27
- ...globals.serviceworker,
28
- },
29
- },
30
- },
31
- {
32
- plugins: {
33
- '@next/next': nextPlugin,
34
- },
35
- rules: {
36
- ...nextPlugin.configs.recommended.rules,
37
- ...nextPlugin.configs['core-web-vitals'].rules,
38
- },
39
- },
40
- {
41
- plugins: {
42
- 'react-hooks': reactHooks,
43
- },
44
- settings: { react: { version: 'detect' } },
45
- rules: {
46
- ...reactHooks.configs.recommended.rules,
47
- // React scope no longer necessary with new JSX transform.
48
- 'react/react-in-jsx-scope': 'off',
49
- },
50
- },
51
- {
52
- files: [
53
- '*.{ts,tsx}',
54
- ],
55
- rules: {
56
- '@typescript-eslint/ban-ts-comment': 'warn',
57
- '@typescript-eslint/no-empty-object-type': 'warn',
58
- '@typescript-eslint/no-explicit-any': 'warn',
59
- '@typescript-eslint/no-unused-vars': 'warn',
60
- /*
61
- '@typescript-eslint/no-unused-vars': [
62
- 'warn',
63
- {
64
- vars: 'all',
65
- args: 'after-used',
66
- ignoreRestSiblings: false,
67
- argsIgnorePattern: '^_',
68
- varsIgnorePattern: '^_',
69
- destructuredArrayIgnorePattern: '^_',
70
- caughtErrorsIgnorePattern: '^(_|ignore)',
71
- },
72
- ],
73
- */
74
- },
75
- },
76
- {
77
- ignores: ['.next/'],
78
- },
79
- ];
1
+ import nextPlugin from '@next/eslint-plugin-next';
2
+ import { fixupPluginRules } from '@eslint/compat';
3
+ import reactPluginSource from 'eslint-plugin-react';
4
+ import reactHooks from 'eslint-plugin-react-hooks';
5
+ import globals from 'globals';
6
+ import { base } from './base.js';
7
+
8
+ // eslint-plugin-react uses context methods removed in eslint 10
9
+ const reactPlugin = fixupPluginRules(reactPluginSource);
10
+ const reactRecommended = {
11
+ ...reactPluginSource.configs.flat.recommended,
12
+ plugins: { react: reactPlugin },
13
+ };
14
+
15
+ /**
16
+ * A custom ESLint configuration for libraries that use Next.js.
17
+ *
18
+ * @type {import("eslint").Linter.Config[]}
19
+ * */
20
+ export const next = [
21
+ ...base,
22
+ {
23
+ ...reactRecommended,
24
+ languageOptions: {
25
+ ...reactRecommended.languageOptions,
26
+ globals: {
27
+ ...globals.serviceworker,
28
+ },
29
+ },
30
+ },
31
+ {
32
+ plugins: {
33
+ '@next/next': nextPlugin,
34
+ },
35
+ rules: {
36
+ ...nextPlugin.configs.recommended.rules,
37
+ ...nextPlugin.configs['core-web-vitals'].rules,
38
+ },
39
+ },
40
+ {
41
+ plugins: {
42
+ 'react-hooks': reactHooks,
43
+ },
44
+ settings: { react: { version: 'detect' } },
45
+ rules: {
46
+ ...reactHooks.configs.recommended.rules,
47
+ // React scope no longer necessary with new JSX transform.
48
+ 'react/react-in-jsx-scope': 'off',
49
+ },
50
+ },
51
+ {
52
+ files: [
53
+ '*.{ts,tsx}',
54
+ ],
55
+ rules: {
56
+ '@typescript-eslint/ban-ts-comment': 'warn',
57
+ '@typescript-eslint/no-empty-object-type': 'warn',
58
+ '@typescript-eslint/no-explicit-any': 'warn',
59
+ '@typescript-eslint/no-unused-vars': 'warn',
60
+ /*
61
+ '@typescript-eslint/no-unused-vars': [
62
+ 'warn',
63
+ {
64
+ vars: 'all',
65
+ args: 'after-used',
66
+ ignoreRestSiblings: false,
67
+ argsIgnorePattern: '^_',
68
+ varsIgnorePattern: '^_',
69
+ destructuredArrayIgnorePattern: '^_',
70
+ caughtErrorsIgnorePattern: '^(_|ignore)',
71
+ },
72
+ ],
73
+ */
74
+ },
75
+ },
76
+ {
77
+ ignores: ['.next/'],
78
+ },
79
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/eslint-config",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Eslint shared config of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
package/plugin.js CHANGED
@@ -1,24 +1,24 @@
1
- import { react } from './react.js';
2
-
3
- /**
4
- * A custom ESLint configuration for plugins.
5
- *
6
- * @type {import("eslint").Linter.Config[]} */
7
- export const plugin = [
8
- ...react,
9
- {
10
- rules: {
11
- 'no-restricted-exports': 'off',
12
- },
13
- },
14
- {
15
- languageOptions: {
16
- // no type-aware rules are enabled, so no typescript project service is needed
17
- // (it failed on files outside the tsconfig, e.g. tests and eslint.config.js)
18
- parserOptions: {
19
- sourceType: 'module',
20
- ecmaVersion: 'latest',
21
- },
22
- },
23
- },
24
- ];
1
+ import { react } from './react.js';
2
+
3
+ /**
4
+ * A custom ESLint configuration for plugins.
5
+ *
6
+ * @type {import("eslint").Linter.Config[]} */
7
+ export const plugin = [
8
+ ...react,
9
+ {
10
+ rules: {
11
+ 'no-restricted-exports': 'off',
12
+ },
13
+ },
14
+ {
15
+ languageOptions: {
16
+ // no type-aware rules are enabled, so no typescript project service is needed
17
+ // (it failed on files outside the tsconfig, e.g. tests and eslint.config.js)
18
+ parserOptions: {
19
+ sourceType: 'module',
20
+ ecmaVersion: 'latest',
21
+ },
22
+ },
23
+ },
24
+ ];
package/react.js CHANGED
@@ -1,40 +1,40 @@
1
- import { fixupPluginRules } from '@eslint/compat';
2
- import reactPluginSource from 'eslint-plugin-react';
3
- import reactHooksPlugin from 'eslint-plugin-react-hooks';
4
- import globals from 'globals';
5
- import { base } from './base.js';
6
-
7
- // eslint-plugin-react uses context methods removed in eslint 10
8
- const reactPlugin = fixupPluginRules(reactPluginSource);
9
- const reactRecommended = {
10
- ...reactPluginSource.configs.flat.recommended,
11
- plugins: { react: reactPlugin },
12
- };
13
-
14
- /**
15
- * A custom ESLint configuration for libraries that use React.
16
- *
17
- * @type {import("eslint").Linter.Config[]} */
18
- export const react = [
19
- ...base,
20
- reactRecommended,
21
- {
22
- languageOptions: {
23
- ...reactRecommended.languageOptions,
24
- globals: {
25
- ...globals.serviceworker,
26
- ...globals.browser,
27
- },
28
- },
29
- },
30
- {
31
- plugins: {
32
- 'react-hooks': reactHooksPlugin,
33
- },
34
- settings: { react: { version: 'detect' } },
35
- rules: {
36
- ...reactHooksPlugin.configs.recommended.rules,
37
- 'react/react-in-jsx-scope': 'off',
38
- },
39
- },
40
- ];
1
+ import { fixupPluginRules } from '@eslint/compat';
2
+ import reactPluginSource from 'eslint-plugin-react';
3
+ import reactHooksPlugin from 'eslint-plugin-react-hooks';
4
+ import globals from 'globals';
5
+ import { base } from './base.js';
6
+
7
+ // eslint-plugin-react uses context methods removed in eslint 10
8
+ const reactPlugin = fixupPluginRules(reactPluginSource);
9
+ const reactRecommended = {
10
+ ...reactPluginSource.configs.flat.recommended,
11
+ plugins: { react: reactPlugin },
12
+ };
13
+
14
+ /**
15
+ * A custom ESLint configuration for libraries that use React.
16
+ *
17
+ * @type {import("eslint").Linter.Config[]} */
18
+ export const react = [
19
+ ...base,
20
+ reactRecommended,
21
+ {
22
+ languageOptions: {
23
+ ...reactRecommended.languageOptions,
24
+ globals: {
25
+ ...globals.serviceworker,
26
+ ...globals.browser,
27
+ },
28
+ },
29
+ },
30
+ {
31
+ plugins: {
32
+ 'react-hooks': reactHooksPlugin,
33
+ },
34
+ settings: { react: { version: 'detect' } },
35
+ rules: {
36
+ ...reactHooksPlugin.configs.recommended.rules,
37
+ 'react/react-in-jsx-scope': 'off',
38
+ },
39
+ },
40
+ ];