@websolutespa/eslint-config 3.0.1-next.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 +12 -3
  2. package/base.js +115 -115
  3. package/next.js +79 -71
  4. package/package.json +13 -12
  5. package/plugin.js +24 -28
  6. package/react.js +40 -32
package/CHANGELOG.md CHANGED
@@ -1,10 +1,19 @@
1
1
  # @websolutespa/eslint-config
2
2
 
3
- ## 3.0.1-next.0
3
+ ## 3.1.0
4
4
 
5
- ### Patch Changes
5
+ ### Minor Changes
6
6
 
7
- - Add a `no-restricted-imports` rule for `next/headers` outside `src/app` and route handlers.
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]`)
8
17
 
9
18
  ## 3.0.0
10
19
 
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
- '.turbo/**',
64
- 'build/**',
65
- 'dist/**',
66
- 'src/app/(payload)/**',
67
- ],
68
- },
69
- {
70
- plugins: { '@stylistic': stylistic },
71
- rules: {
72
- '@stylistic/quotes': ['error', 'single'],
73
- 'comma-dangle': ['warn', {
74
- 'arrays': 'always-multiline',
75
- 'objects': 'always-multiline',
76
- 'imports': 'never',
77
- 'exports': 'never',
78
- 'functions': 'never',
79
- }],
80
- 'for-direction': 'off',
81
- 'indent': ['error', 2, {
82
- 'SwitchCase': 1,
83
- }],
84
- 'jsx-quotes': ['error', 'prefer-double'],
85
- 'no-cond-assign': ['error', 'always'],
86
- 'no-empty-function': 'off',
87
- 'no-empty': 'warn',
88
- 'no-extra-semi': 'error',
89
- 'no-multi-spaces': 'error',
90
- 'no-unreachable': 'error',
91
- 'no-unused-vars': 'off',
92
- 'quotes': ['error', 'single'],
93
- '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,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,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/eslint-config",
3
- "version": "3.0.1-next.0",
3
+ "version": "3.1.0",
4
4
  "description": "Eslint shared config of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -15,20 +15,21 @@
15
15
  },
16
16
  "type": "module",
17
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",
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",
24
25
  "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"
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"
29
30
  },
30
31
  "devDependencies": {
31
- "typescript": "5.8.3"
32
+ "typescript": "6.0.3"
32
33
  },
33
34
  "main": "./base.js",
34
35
  "exports": {
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
+ ];