@websolutespa/eslint-config 1.10.0-next.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 ADDED
@@ -0,0 +1,49 @@
1
+ # @websolutespa/eslint-config
2
+
3
+ ## 1.10.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Updating: React 19.x, Payload 3.x
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.
package/README.md ADDED
@@ -0,0 +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*
package/base.js ADDED
@@ -0,0 +1,48 @@
1
+ import js from '@eslint/js';
2
+ import eslintConfigPrettier from 'eslint-config-prettier';
3
+ import onlyWarn from 'eslint-plugin-only-warn';
4
+ import turboPlugin from 'eslint-plugin-turbo';
5
+ import tseslint from 'typescript-eslint';
6
+ import { rules } from './rules';
7
+
8
+ /**
9
+ * A shared ESLint configuration for the repository.
10
+ *
11
+ * @type {import("eslint").Linter.Config[]}
12
+ * */
13
+ export const config = [
14
+ js.configs.recommended,
15
+ eslintConfigPrettier,
16
+ ...tseslint.configs.recommended,
17
+ {
18
+ plugins: {
19
+ turbo: turboPlugin,
20
+ },
21
+ rules: {
22
+ 'turbo/no-undeclared-env-vars': 'warn',
23
+ },
24
+ },
25
+ {
26
+ plugins: {
27
+ onlyWarn,
28
+ },
29
+ },
30
+ {
31
+ ignores: ['dist/**'],
32
+ },
33
+ ...rules,
34
+ {
35
+ languageOptions: {
36
+ parserOptions: {
37
+ sourceType: 'module',
38
+ ecmaVersion: 'latest',
39
+ projectService: {
40
+ maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 40,
41
+ allowDefaultProject: ['scripts/*.ts', '*.js', '*.mjs', '*.spec.ts', '*.d.ts'],
42
+ },
43
+ // projectService: true,
44
+ tsconfigRootDir: import.meta.dirname,
45
+ },
46
+ },
47
+ },
48
+ ];
package/next.js ADDED
@@ -0,0 +1,51 @@
1
+ import js from '@eslint/js';
2
+ import pluginNext from '@next/eslint-plugin-next';
3
+ import eslintConfigPrettier from 'eslint-config-prettier';
4
+ import pluginReact from 'eslint-plugin-react';
5
+ import pluginReactHooks from 'eslint-plugin-react-hooks';
6
+ import globals from 'globals';
7
+ import tseslint from 'typescript-eslint';
8
+ import { config as baseConfig } from './base.js';
9
+ import { rules } from './rules.js';
10
+
11
+ /**
12
+ * A custom ESLint configuration for libraries that use Next.js.
13
+ *
14
+ * @type {import('eslint').Linter.Config[]}
15
+ * */
16
+ export const config = [
17
+ js.configs.recommended,
18
+ eslintConfigPrettier,
19
+ ...tseslint.configs.recommended,
20
+ ...baseConfig,
21
+ {
22
+ ...pluginReact.configs.flat.recommended,
23
+ languageOptions: {
24
+ ...pluginReact.configs.flat.recommended.languageOptions,
25
+ globals: {
26
+ ...globals.serviceworker,
27
+ },
28
+ },
29
+ },
30
+ {
31
+ plugins: {
32
+ '@next/next': pluginNext,
33
+ },
34
+ rules: {
35
+ ...pluginNext.configs.recommended.rules,
36
+ ...pluginNext.configs['core-web-vitals'].rules,
37
+ },
38
+ },
39
+ {
40
+ plugins: {
41
+ 'react-hooks': pluginReactHooks,
42
+ },
43
+ settings: { react: { version: 'detect' } },
44
+ rules: {
45
+ ...pluginReactHooks.configs.recommended.rules,
46
+ // React scope no longer necessary with new JSX transform.
47
+ 'react/react-in-jsx-scope': 'off',
48
+ },
49
+ },
50
+ ...rules,
51
+ ];
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@websolutespa/eslint-config",
3
+ "version": "1.10.0-next.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
+ "dependencies": {
17
+ "@eslint/js": "^9.28.0",
18
+ "@next/eslint-plugin-next": "^15.3.0",
19
+ "eslint": "^9.28.0",
20
+ "eslint-config-prettier": "^10.1.1",
21
+ "eslint-plugin-only-warn": "^1.1.0",
22
+ "eslint-plugin-react": "^7.37.4",
23
+ "eslint-plugin-react-hooks": "^5.2.0",
24
+ "eslint-plugin-turbo": "^2.5.0",
25
+ "globals": "^16.2.0",
26
+ "typescript": "5.8.2",
27
+ "typescript-eslint": "^8.33.0"
28
+ },
29
+ "exports": {
30
+ "./base": "./base.js",
31
+ "./next": "./next.js",
32
+ "./react": "./react.js"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "sideEffects": false,
38
+ "main": "base.js",
39
+ "type": "module"
40
+ }
package/react.js ADDED
@@ -0,0 +1,30 @@
1
+ import pluginReact from 'eslint-plugin-react';
2
+ import pluginReactHooks from 'eslint-plugin-react-hooks';
3
+ import globals from 'globals';
4
+ import { config as baseConfig } from './base.js';
5
+ import { rules } from './rules.js';
6
+
7
+ /**
8
+ * A custom ESLint configuration for libraries that use React.
9
+ *
10
+ * @type {import('eslint').Linter.Config[]} */
11
+ export const config = [
12
+ ...baseConfig,
13
+ pluginReact.configs.flat.recommended,
14
+ {
15
+ languageOptions: {
16
+ ...pluginReact.configs.flat.recommended.languageOptions,
17
+ globals: {
18
+ ...globals.serviceworker,
19
+ ...globals.browser,
20
+ },
21
+ },
22
+ },
23
+ {
24
+ plugins: {
25
+ 'react-hooks': pluginReactHooks,
26
+ },
27
+ settings: { react: { version: 'detect' } },
28
+ },
29
+ ...rules,
30
+ ];
package/rules.js ADDED
@@ -0,0 +1,160 @@
1
+ import { FlatCompat } from '@eslint/eslintrc';
2
+ import pluginReactHooks from 'eslint-plugin-react-hooks';
3
+ import globals from 'globals';
4
+ import { dirname } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ const compat = new FlatCompat({
11
+ baseDirectory: __dirname,
12
+ });
13
+
14
+ /**
15
+ * A shared ESLint configuration for the repository.
16
+ *
17
+ * @type {import("eslint").Linter.Config}
18
+ * */
19
+ export const rules = compat.config({
20
+ plugins: [
21
+ '@typescript-eslint',
22
+ 'react',
23
+ 'react-hooks',
24
+ ],
25
+ rules: {
26
+ 'for-direction': 'off',
27
+ 'jsx-quotes': ['error', 'prefer-double'],
28
+ 'no-cond-assign': ['error', 'always'],
29
+ 'no-empty-function': 'off',
30
+ 'no-empty': 'warn',
31
+ 'semi': 'error',
32
+ 'no-extra-semi': 'error',
33
+ 'no-unreachable': 'error',
34
+ 'no-unused-vars': 'off',
35
+ 'quotes': ['error', 'single'],
36
+ },
37
+ overrides: [
38
+ {
39
+ // for every js
40
+ files: [
41
+ '*.{js,jsx,ts,tsx}',
42
+ ],
43
+ rules: {
44
+ 'comma-dangle': ['warn', {
45
+ 'arrays': 'always-multiline',
46
+ 'objects': 'always-multiline',
47
+ 'imports': 'never',
48
+ 'exports': 'never',
49
+ 'functions': 'never',
50
+ }],
51
+ 'indent': ['error', 2, { 'SwitchCase': 1 }],
52
+ 'no-multi-spaces': 'error',
53
+ },
54
+ },
55
+ {
56
+ // for every react
57
+ files: [
58
+ '*.{jsx,tsx}',
59
+ ],
60
+ plugins: [
61
+ 'react',
62
+ ],
63
+ parserOptions: {
64
+ ecmaFeatures: {
65
+ jsx: true,
66
+ },
67
+ },
68
+ languageOptions: {
69
+ globals: {
70
+ ...globals.serviceworker,
71
+ ...globals.browser,
72
+ },
73
+ },
74
+ rules: {
75
+ 'react/display-name': 'error',
76
+ 'react/jsx-no-comment-textnodes': 'error',
77
+ 'react/jsx-no-duplicate-props': 'error',
78
+ 'react/jsx-no-target-blank': 'error',
79
+ 'react/jsx-no-undef': 'error',
80
+ 'react/jsx-uses-react': 'error',
81
+ 'react/jsx-uses-vars': 'error',
82
+ 'react/no-children-prop': 'error',
83
+ 'react/no-danger-with-children': 'error',
84
+ 'react/no-deprecated': 'error',
85
+ 'react/no-direct-mutation-state': 'error',
86
+ 'react/no-find-dom-node': 'error',
87
+ 'react/no-is-mounted': 'error',
88
+ 'react/no-render-return-value': 'error',
89
+ 'react/no-string-refs': 'error',
90
+ 'react/no-unknown-property': 'error',
91
+ 'react/no-unsafe': 'off',
92
+ 'react/require-render-return': 'error',
93
+ 'react/jsx-key': 'off',
94
+ 'react/no-unescaped-entities': 'off',
95
+ 'react/prop-types': 'off',
96
+ 'react/react-in-jsx-scope': 'off',
97
+ },
98
+ settings: {
99
+ react: {
100
+ version: 'detect',
101
+ },
102
+ },
103
+ },
104
+ {
105
+ // for every react hooks
106
+ files: [
107
+ '*.{jsx,tsx}',
108
+ ],
109
+ plugins: {
110
+ 'react-hooks': pluginReactHooks,
111
+ },
112
+ rules: {
113
+ 'react-hooks/rules-of-hooks': 'error',
114
+ 'react-hooks/exhaustive-deps': 'warn',
115
+ },
116
+ settings: {
117
+ react: {
118
+ version: 'detect',
119
+ },
120
+ },
121
+ },
122
+ {
123
+ // for every typescript
124
+ files: [
125
+ '*.{ts,tsx}',
126
+ ],
127
+ rules: {
128
+ // '@typescript-eslint/member-delimiter-style': 'error',
129
+ '@typescript-eslint/ban-types': 'off',
130
+ '@typescript-eslint/consistent-type-imports': ['warn', {
131
+ prefer: 'no-type-imports',
132
+ }],
133
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
134
+ '@typescript-eslint/no-empty-function': 'off',
135
+ '@typescript-eslint/no-empty-interface': 'off',
136
+ '@typescript-eslint/no-explicit-any': 'warn',
137
+ '@typescript-eslint/no-inferrable-types': 'off',
138
+ '@typescript-eslint/no-unused-vars': 'warn',
139
+ '@typescript-eslint/no-use-before-define': ['error', {
140
+ 'functions': false,
141
+ 'classes': false,
142
+ 'variables': true,
143
+ 'allowNamedExports': false,
144
+ }],
145
+ // '@typescript-eslint/semi': 'error',
146
+ },
147
+ },
148
+ {
149
+ // for next app
150
+ files: [
151
+ 'src/pages/**/*.{js,jsx,ts,tsx}',
152
+ ],
153
+ extends: ['next/core-web-vitals', 'next/typescript'],
154
+ rules: {
155
+ '@next/next/no-page-custom-font': 'off',
156
+ 'react/no-unescaped-entities': 'off',
157
+ },
158
+ },
159
+ ],
160
+ });