@websolutespa/eslint-config 3.1.2 → 4.0.0-next.7

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,35 @@
1
1
  # @websolutespa/eslint-config
2
2
 
3
+ ## 4.0.0-next.7
4
+
5
+ ### Patch Changes
6
+
7
+ - The oxlint presets move to the new package `@websolutespa/oxc`, with type declarations and the shared oxfmt config; `@websolutespa/eslint-config` is the ESLint 10 configs again and no longer exports `./oxlint`.
8
+
9
+ - `oxlint.config.ts`: `import { next } from '@websolutespa/oxc/oxlint'` (was `@websolutespa/eslint-config/oxlint`).
10
+ - `.oxfmtrc.json` becomes `oxfmt.config.ts`: `import { format } from '@websolutespa/oxc/oxfmt'; export default defineConfig(format);`.
11
+ - A project that declared the presets itself (a local `.d.ts` for `@websolutespa/eslint-config/oxlint`) drops it.
12
+
13
+ ## 4.0.0-next.6
14
+
15
+ ### Minor Changes
16
+
17
+ - aa3870b: Adds oxlint presets, `@websolutespa/eslint-config/oxlint` (`base`, `react`, `next`, `plugin`), generated from the ESLint presets with every rule as a warning. Use them from an `oxlint.config.ts`:
18
+
19
+ ```ts
20
+ import { next } from "@websolutespa/eslint-config/oxlint";
21
+ import { defineConfig } from "oxlint";
22
+ export default defineConfig(next);
23
+ ```
24
+
25
+ Run `oxlint --type-aware` (with `oxlint-tsgolint`) for the promise rules. The ESLint flat configs are still exported for one more release.
26
+
27
+ ## 3.0.1-next.0
28
+
29
+ ### Patch Changes
30
+
31
+ - Add a `no-restricted-imports` rule for `next/headers` outside `src/app` and route handlers.
32
+
3
33
  ## 3.1.2
4
34
 
5
35
  ## 3.1.1
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @websolutespa/eslint-config
2
-
3
- [![npm version](https://badge.fury.io/js/@websolutespa/eslint-config.svg)](https://badge.fury.io/js/@websolutespa/eslint-config)
4
-
5
- Eslint shared config of the [BOM Repository](https://github.com/websolutespa/bom) by [websolute](https://www.websolute.com/).
6
-
7
- This package provides Websolute's .eslintrc as an extensible shared config.
8
-
9
- ---
10
-
11
- ##### *this library is for internal usage and not production ready*
1
+ # @websolutespa/eslint-config
2
+
3
+ [![npm version](https://badge.fury.io/js/@websolutespa/eslint-config.svg)](https://badge.fury.io/js/@websolutespa/eslint-config)
4
+
5
+ Eslint shared config of the [BOM Repository](https://github.com/websolutespa/bom) by [websolute](https://www.websolute.com/).
6
+
7
+ This package provides Websolute's .eslintrc as an extensible shared config.
8
+
9
+ ---
10
+
11
+ ##### _this library is for internal usage and not production ready_
package/base.js CHANGED
@@ -1,115 +1,126 @@
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': [
43
+ 'warn',
44
+ {
45
+ paths: [
46
+ {
47
+ name: 'next/headers',
48
+ message:
49
+ 'Read request data (headers, cookies, draftMode) in the template under src/app and pass it down as an argument.',
50
+ },
51
+ ],
52
+ },
53
+ ],
54
+ },
55
+ },
56
+ {
57
+ files: ['src/app/**', '**/handlers/**', '**/*.test.{ts,tsx}'],
58
+ rules: {
59
+ 'no-restricted-imports': 'off',
60
+ },
61
+ },
62
+ {
63
+ ignores: [
64
+ '**/.next/**',
65
+ '**/.rollup.cache/**',
66
+ '**/.turbo/**',
67
+ '**/build/**',
68
+ '**/dist/**',
69
+ 'src/app/(payload)/**',
70
+ ],
71
+ },
72
+ {
73
+ plugins: { '@stylistic': stylistic },
74
+ rules: {
75
+ '@stylistic/quotes': ['error', 'single'],
76
+ '@stylistic/comma-dangle': [
77
+ 'warn',
78
+ {
79
+ arrays: 'always-multiline',
80
+ objects: 'always-multiline',
81
+ imports: 'never',
82
+ exports: 'never',
83
+ functions: 'never',
84
+ },
85
+ ],
86
+ 'for-direction': 'off',
87
+ '@stylistic/indent': [
88
+ 'error',
89
+ 2,
90
+ {
91
+ SwitchCase: 1,
92
+ },
93
+ ],
94
+ '@stylistic/jsx-quotes': ['error', 'prefer-double'],
95
+ 'no-cond-assign': ['error', 'always'],
96
+ 'no-empty-function': 'off',
97
+ 'no-empty': 'warn',
98
+ '@stylistic/no-extra-semi': 'error',
99
+ '@stylistic/no-multi-spaces': 'error',
100
+ 'no-unreachable': 'error',
101
+ 'no-unused-vars': 'off',
102
+ '@stylistic/semi': 'error',
103
+ },
104
+ },
105
+ {
106
+ files: ['*.{ts,tsx}'],
107
+ rules: {
108
+ '@typescript-eslint/ban-types': 'off',
109
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
110
+ '@typescript-eslint/no-empty-function': 'off',
111
+ '@typescript-eslint/no-empty-interface': 'off',
112
+ '@typescript-eslint/no-explicit-any': 'warn',
113
+ '@typescript-eslint/no-inferrable-types': 'off',
114
+ '@typescript-eslint/no-unused-vars': 'warn',
115
+ '@typescript-eslint/no-use-before-define': [
116
+ 'error',
117
+ {
118
+ functions: false,
119
+ classes: false,
120
+ variables: true,
121
+ allowNamedExports: false,
122
+ },
123
+ ],
124
+ },
125
+ },
126
+ ];
package/next.js CHANGED
@@ -1,79 +1,77 @@
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: ['*.{ts,tsx}'],
53
+ rules: {
54
+ '@typescript-eslint/ban-ts-comment': 'warn',
55
+ '@typescript-eslint/no-empty-object-type': 'warn',
56
+ '@typescript-eslint/no-explicit-any': 'warn',
57
+ '@typescript-eslint/no-unused-vars': 'warn',
58
+ /*
59
+ '@typescript-eslint/no-unused-vars': [
60
+ 'warn',
61
+ {
62
+ vars: 'all',
63
+ args: 'after-used',
64
+ ignoreRestSiblings: false,
65
+ argsIgnorePattern: '^_',
66
+ varsIgnorePattern: '^_',
67
+ destructuredArrayIgnorePattern: '^_',
68
+ caughtErrorsIgnorePattern: '^(_|ignore)',
69
+ },
70
+ ],
71
+ */
72
+ },
73
+ },
74
+ {
75
+ ignores: ['.next/'],
76
+ },
77
+ ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@websolutespa/eslint-config",
3
- "version": "3.1.2",
4
- "description": "Eslint shared config of the BOM Repository",
3
+ "version": "4.0.0-next.7",
4
+ "description": "Eslint shared configs of the BOM Repository (oxlint and oxfmt: @websolutespa/oxc)",
5
5
  "keywords": [
6
6
  "bom",
7
7
  "eslint",
@@ -39,4 +39,4 @@
39
39
  "./plugin": "./plugin.js",
40
40
  "./react": "./react.js"
41
41
  }
42
- }
42
+ }
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
+ ];