@websolutespa/eslint-config 3.0.0 → 3.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 (6) hide show
  1. package/CHANGELOG.md +64 -49
  2. package/base.js +115 -93
  3. package/next.js +79 -71
  4. package/package.json +42 -41
  5. package/plugin.js +24 -28
  6. package/react.js +40 -32
package/CHANGELOG.md CHANGED
@@ -1,49 +1,64 @@
1
- # @websolutespa/eslint-config
2
-
3
- ## 3.0.0
4
-
5
- ### Major Changes
6
-
7
- - Release: Bom 3.0
8
-
9
- ## 0.1.2
10
-
11
- ### Patch Changes
12
-
13
- - Fixing: downgrading eslint to v8.56.0
14
-
15
- ## 0.1.1
16
-
17
- ### Patch Changes
18
-
19
- - Updating: dependencies
20
-
21
- ## 0.1.0
22
-
23
- ### Minor Changes
24
-
25
- - Updating: next 13.
26
-
27
- ## 0.0.5
28
-
29
- ### Patch Changes
30
-
31
- - Added: mdx files.
32
-
33
- ## 0.0.4
34
-
35
- ### Patch Changes
36
-
37
- - Added: mdx support.
38
-
39
- ## 0.0.3
40
-
41
- ### Patch Changes
42
-
43
- - Added: no-unreachable error.
44
-
45
- ## 0.0.2
46
-
47
- ### Patch Changes
48
-
49
- - Added: first release.
1
+ # @websolutespa/eslint-config
2
+
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 044732e: - ESLint 10 (@eslint/js 10, typescript-eslint 8.72, react-hooks 7, @stylistic 5.10, globals 17)
8
+ - core formatting rules replaced by their `@stylistic/*` equivalents
9
+ - eslint-plugin-react wrapped with `@eslint/compat` `fixupPluginRules` (it uses context methods removed in ESLint 10)
10
+ - plugin config: no typescript project service (no type-aware rules are enabled)
11
+ - `no-restricted-imports` for `next/headers` outside `src/app`, handlers and tests (as on the bom-next branch)
12
+ - ignore patterns (`dist`, `build`, `.next`, `.turbo`, `.rollup.cache`) match at any depth: ESLint 10 resolves the config from each file's directory, so a parent config no longer ignored nested `dist` folders
13
+ - 3f7c21b: - Payload 3.91.0 and Next.js 16.4.2 (React 19.2.9): peer dependencies are now ranges, `payload` / `@payloadcms/*` `^3.91.0`, `next` `^16.3.3`, `react` / `react-dom` `^19.2.1`
14
+ - payload-plugin-bowl: the mixer context is built only for reads by an authenticated user (payload 3.90+ resolves the jwt user with the request query, populating tenants before `req.user` is set); email options typed with payload `SendEmailOptions`, no direct nodemailer dependency
15
+ - payload-plugin-storage: `AZURE_STORAGE_CONTAINER_ACCESS` (`private` default since payload 3.90, `blob`, `container`) for containers created by the plugin
16
+ - mixer web: `images.qualities` includes `IMAGE_QUALITY` (next 16 defaults to `[75]`)
17
+
18
+ ## 3.0.0
19
+
20
+ ### Major Changes
21
+
22
+ - Release: Bom 3.0
23
+
24
+ ## 0.1.2
25
+
26
+ ### Patch Changes
27
+
28
+ - Fixing: downgrading eslint to v8.56.0
29
+
30
+ ## 0.1.1
31
+
32
+ ### Patch Changes
33
+
34
+ - Updating: dependencies
35
+
36
+ ## 0.1.0
37
+
38
+ ### Minor Changes
39
+
40
+ - Updating: next 13.
41
+
42
+ ## 0.0.5
43
+
44
+ ### Patch Changes
45
+
46
+ - Added: mdx files.
47
+
48
+ ## 0.0.4
49
+
50
+ ### Patch Changes
51
+
52
+ - Added: mdx support.
53
+
54
+ ## 0.0.3
55
+
56
+ ### Patch Changes
57
+
58
+ - Added: no-unreachable error.
59
+
60
+ ## 0.0.2
61
+
62
+ ### Patch Changes
63
+
64
+ - Added: first release.
package/base.js CHANGED
@@ -1,93 +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
- ignores: [
40
- '.next/**',
41
- '.turbo/**',
42
- 'build/**',
43
- 'dist/**',
44
- 'src/app/(payload)/**',
45
- ],
46
- },
47
- {
48
- plugins: { '@stylistic': stylistic },
49
- rules: {
50
- '@stylistic/quotes': ['error', 'single'],
51
- 'comma-dangle': ['warn', {
52
- 'arrays': 'always-multiline',
53
- 'objects': 'always-multiline',
54
- 'imports': 'never',
55
- 'exports': 'never',
56
- 'functions': 'never',
57
- }],
58
- 'for-direction': 'off',
59
- 'indent': ['error', 2, {
60
- 'SwitchCase': 1,
61
- }],
62
- 'jsx-quotes': ['error', 'prefer-double'],
63
- 'no-cond-assign': ['error', 'always'],
64
- 'no-empty-function': 'off',
65
- 'no-empty': 'warn',
66
- 'no-extra-semi': 'error',
67
- 'no-multi-spaces': 'error',
68
- 'no-unreachable': 'error',
69
- 'no-unused-vars': 'off',
70
- 'quotes': ['error', 'single'],
71
- 'semi': 'error',
72
- },
73
- }, {
74
- files: [
75
- '*.{ts,tsx}',
76
- ],
77
- rules: {
78
- '@typescript-eslint/ban-types': 'off',
79
- '@typescript-eslint/explicit-module-boundary-types': 'off',
80
- '@typescript-eslint/no-empty-function': 'off',
81
- '@typescript-eslint/no-empty-interface': 'off',
82
- '@typescript-eslint/no-explicit-any': 'warn',
83
- '@typescript-eslint/no-inferrable-types': 'off',
84
- '@typescript-eslint/no-unused-vars': 'warn',
85
- '@typescript-eslint/no-use-before-define': ['error', {
86
- 'functions': false,
87
- 'classes': false,
88
- 'variables': true,
89
- 'allowNamedExports': false,
90
- }],
91
- },
92
- },
93
- ];
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,71 +1,79 @@
1
- import nextPlugin from '@next/eslint-plugin-next';
2
- import reactPlugin from 'eslint-plugin-react';
3
- import reactHooks from 'eslint-plugin-react-hooks';
4
- import globals from 'globals';
5
- import { base } from './base.js';
6
-
7
- /**
8
- * A custom ESLint configuration for libraries that use Next.js.
9
- *
10
- * @type {import("eslint").Linter.Config[]}
11
- * */
12
- export const next = [
13
- ...base,
14
- {
15
- ...reactPlugin.configs.flat.recommended,
16
- languageOptions: {
17
- ...reactPlugin.configs.flat.recommended.languageOptions,
18
- globals: {
19
- ...globals.serviceworker,
20
- },
21
- },
22
- },
23
- {
24
- plugins: {
25
- '@next/next': nextPlugin,
26
- },
27
- rules: {
28
- ...nextPlugin.configs.recommended.rules,
29
- ...nextPlugin.configs['core-web-vitals'].rules,
30
- },
31
- },
32
- {
33
- plugins: {
34
- 'react-hooks': reactHooks,
35
- },
36
- settings: { react: { version: 'detect' } },
37
- rules: {
38
- ...reactHooks.configs.recommended.rules,
39
- // React scope no longer necessary with new JSX transform.
40
- 'react/react-in-jsx-scope': 'off',
41
- },
42
- },
43
- {
44
- files: [
45
- '*.{ts,tsx}',
46
- ],
47
- rules: {
48
- '@typescript-eslint/ban-ts-comment': 'warn',
49
- '@typescript-eslint/no-empty-object-type': 'warn',
50
- '@typescript-eslint/no-explicit-any': 'warn',
51
- '@typescript-eslint/no-unused-vars': 'warn',
52
- /*
53
- '@typescript-eslint/no-unused-vars': [
54
- 'warn',
55
- {
56
- vars: 'all',
57
- args: 'after-used',
58
- ignoreRestSiblings: false,
59
- argsIgnorePattern: '^_',
60
- varsIgnorePattern: '^_',
61
- destructuredArrayIgnorePattern: '^_',
62
- caughtErrorsIgnorePattern: '^(_|ignore)',
63
- },
64
- ],
65
- */
66
- },
67
- },
68
- {
69
- ignores: ['.next/'],
70
- },
71
- ];
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,41 +1,42 @@
1
- {
2
- "name": "@websolutespa/eslint-config",
3
- "version": "3.0.0",
4
- "description": "Eslint shared config of the BOM Repository",
5
- "keywords": [
6
- "bom",
7
- "eslint",
8
- "config",
9
- "websolute"
10
- ],
11
- "license": "MIT",
12
- "repository": {
13
- "type": "git",
14
- "url": "git://github.com/websolutespa/bom.git"
15
- },
16
- "type": "module",
17
- "dependencies": {
18
- "@eslint/js": "9.31.0",
19
- "@next/eslint-plugin-next": "16.1.6",
20
- "@stylistic/eslint-plugin": "5.2.3",
21
- "eslint": "9.31.0",
22
- "eslint-config-prettier": "10.1.1",
23
- "eslint-plugin-only-warn": "1.1.0",
24
- "eslint-plugin-react": "7.37.5",
25
- "eslint-plugin-react-hooks": "5.2.0",
26
- "eslint-plugin-turbo": "2.5.0",
27
- "globals": "16.3.0",
28
- "typescript-eslint": "8.36.0"
29
- },
30
- "devDependencies": {
31
- "typescript": "5.8.3"
32
- },
33
- "main": "./base.js",
34
- "exports": {
35
- ".": "./base.js",
36
- "./base": "./base.js",
37
- "./next": "./next.js",
38
- "./plugin": "./plugin.js",
39
- "./react": "./react.js"
40
- }
41
- }
1
+ {
2
+ "name": "@websolutespa/eslint-config",
3
+ "version": "3.1.0",
4
+ "description": "Eslint shared config of the BOM Repository",
5
+ "keywords": [
6
+ "bom",
7
+ "eslint",
8
+ "config",
9
+ "websolute"
10
+ ],
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git://github.com/websolutespa/bom.git"
15
+ },
16
+ "type": "module",
17
+ "dependencies": {
18
+ "@eslint/compat": "2.1.1",
19
+ "@eslint/js": "10.0.1",
20
+ "@next/eslint-plugin-next": "16.4.2",
21
+ "@stylistic/eslint-plugin": "5.10.0",
22
+ "eslint": "10.13.0",
23
+ "eslint-config-prettier": "10.1.8",
24
+ "eslint-plugin-only-warn": "1.2.1",
25
+ "eslint-plugin-react": "7.37.5",
26
+ "eslint-plugin-react-hooks": "7.1.1",
27
+ "eslint-plugin-turbo": "2.11.10",
28
+ "globals": "17.13.0",
29
+ "typescript-eslint": "8.72.0"
30
+ },
31
+ "devDependencies": {
32
+ "typescript": "6.0.3"
33
+ },
34
+ "main": "./base.js",
35
+ "exports": {
36
+ ".": "./base.js",
37
+ "./base": "./base.js",
38
+ "./next": "./next.js",
39
+ "./plugin": "./plugin.js",
40
+ "./react": "./react.js"
41
+ }
42
+ }
package/plugin.js CHANGED
@@ -1,28 +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
- parserOptions: {
17
- sourceType: 'module',
18
- ecmaVersion: 'latest',
19
- projectService: {
20
- maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 40,
21
- allowDefaultProject: ['scripts/*.ts', '*.js', '*.mjs', '*.spec.ts', '*.d.ts'],
22
- },
23
- // projectService: true,
24
- tsconfigRootDir: import.meta.dirname,
25
- },
26
- },
27
- },
28
- ];
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,32 +1,40 @@
1
- import reactPlugin from 'eslint-plugin-react';
2
- import reactHooksPlugin from 'eslint-plugin-react-hooks';
3
- import globals from 'globals';
4
- import { base } from './base.js';
5
-
6
- /**
7
- * A custom ESLint configuration for libraries that use React.
8
- *
9
- * @type {import("eslint").Linter.Config[]} */
10
- export const react = [
11
- ...base,
12
- reactPlugin.configs.flat.recommended,
13
- {
14
- languageOptions: {
15
- ...reactPlugin.configs.flat.recommended.languageOptions,
16
- globals: {
17
- ...globals.serviceworker,
18
- ...globals.browser,
19
- },
20
- },
21
- },
22
- {
23
- plugins: {
24
- 'react-hooks': reactHooksPlugin,
25
- },
26
- settings: { react: { version: 'detect' } },
27
- rules: {
28
- ...reactHooksPlugin.configs.recommended.rules,
29
- 'react/react-in-jsx-scope': 'off',
30
- },
31
- },
32
- ];
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
+ ];