@leestratman/eslint-config 0.0.0-stage → 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lee Stratman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/base.js ADDED
@@ -0,0 +1,95 @@
1
+ import js from '@eslint/js';
2
+ import eslintConfigPrettier from 'eslint-config-prettier';
3
+ import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
4
+ import { importX } from 'eslint-plugin-import-x';
5
+ import globals from 'globals';
6
+ import tseslint from 'typescript-eslint';
7
+
8
+ /**
9
+ * Rules every TypeScript project is held to.
10
+ *
11
+ * Every rule here is an error. Existing violations are absorbed with ESLint's
12
+ * bulk suppressions (`eslint --suppress-all`), so new code complies and the
13
+ * suppressed count only goes down. See README.md.
14
+ *
15
+ * @type {import("eslint").Linter.Config[]}
16
+ */
17
+ export const base = [
18
+ js.configs.recommended,
19
+ ...tseslint.configs.recommended,
20
+ {
21
+ plugins: { 'import-x': importX },
22
+ settings: {
23
+ // Without these, import-x only follows .js files and misses TS cycles.
24
+ 'import-x/extensions': importX.flatConfigs.typescript.settings['import-x/extensions'],
25
+ 'import-x/parsers': importX.flatConfigs.typescript.settings['import-x/parsers'],
26
+ 'import-x/resolver-next': [createTypeScriptImportResolver()],
27
+ },
28
+ rules: {
29
+ // Circular imports make load order matter and hide layering mistakes.
30
+ 'import-x/no-cycle': ['error', { ignoreExternal: true }],
31
+
32
+ // A swallowed error is a bug nobody hears about. Log it or rethrow.
33
+ 'no-empty': ['error', { allowEmptyCatch: false }],
34
+
35
+ '@typescript-eslint/no-explicit-any': 'error',
36
+ '@typescript-eslint/no-unused-vars': [
37
+ 'error',
38
+ {
39
+ args: 'all',
40
+ argsIgnorePattern: '^_',
41
+ varsIgnorePattern: '^_',
42
+ caughtErrors: 'all',
43
+ caughtErrorsIgnorePattern: '^_',
44
+ destructuredArrayIgnorePattern: '^_',
45
+ ignoreRestSiblings: true,
46
+ },
47
+ ],
48
+ '@typescript-eslint/ban-ts-comment': [
49
+ 'error',
50
+ {
51
+ 'ts-expect-error': 'allow-with-description',
52
+ 'ts-ignore': true,
53
+ 'ts-nocheck': true,
54
+ 'ts-check': false,
55
+ minimumDescriptionLength: 10,
56
+ },
57
+ ],
58
+
59
+ // Size budgets: a function past these is doing more than one thing.
60
+ complexity: ['error', 15],
61
+ 'max-lines-per-function': [
62
+ 'error',
63
+ { max: 80, skipBlankLines: true, skipComments: true },
64
+ ],
65
+ 'max-lines': [
66
+ 'error',
67
+ { max: 600, skipBlankLines: true, skipComments: true },
68
+ ],
69
+ },
70
+ },
71
+ // Plain JS files (configs, server entry points) run in Node.
72
+ {
73
+ files: ['**/*.{js,mjs,cjs}'],
74
+ languageOptions: { globals: { ...globals.node } },
75
+ },
76
+ // Tests, stories and generated files are long by nature.
77
+ {
78
+ files: [
79
+ '**/*.{test,spec}.{ts,tsx}',
80
+ '**/{test,tests,__tests__}/**/*.{ts,tsx}',
81
+ '**/*.stories.{ts,tsx}',
82
+ '**/*.generated.ts',
83
+ ],
84
+ rules: {
85
+ complexity: 'off',
86
+ 'max-lines-per-function': 'off',
87
+ 'max-lines': 'off',
88
+ '@typescript-eslint/no-explicit-any': 'off',
89
+ },
90
+ },
91
+ // Formatting belongs to Prettier; turn off any rule that would fight it.
92
+ eslintConfigPrettier,
93
+ ];
94
+
95
+ export default base;
package/next.js ADDED
@@ -0,0 +1,20 @@
1
+ import pluginNext from '@next/eslint-plugin-next';
2
+ import { react } from './react.js';
3
+
4
+ /**
5
+ * react plus the Next.js rules (recommended and Core Web Vitals).
6
+ *
7
+ * @type {import("eslint").Linter.Config[]}
8
+ */
9
+ export const next = [
10
+ ...react,
11
+ {
12
+ plugins: { '@next/next': pluginNext },
13
+ rules: {
14
+ ...pluginNext.configs.recommended.rules,
15
+ ...pluginNext.configs['core-web-vitals'].rules,
16
+ },
17
+ },
18
+ ];
19
+
20
+ export default next;
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@leestratman/eslint-config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Strict, shared ESLint flat config for TypeScript, React and Next.js: no cycles, no any, no swallowed errors, size budgets.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "exports": {
8
+ "./base": "./base.js",
9
+ "./react": "./react.js",
10
+ "./next": "./next.js"
11
+ },
12
+ "files": [
13
+ "base.js",
14
+ "react.js",
15
+ "next.js",
16
+ "LICENSE"
17
+ ],
18
+ "peerDependencies": {
19
+ "eslint": "^9.24.0",
20
+ "typescript": ">=5.0.0"
21
+ },
22
+ "dependencies": {
23
+ "@eslint/js": "^9.39.0",
24
+ "@next/eslint-plugin-next": "^16.0.0",
25
+ "eslint-config-prettier": "^10.1.0",
26
+ "eslint-import-resolver-typescript": "^4.4.0",
27
+ "eslint-plugin-import-x": "^4.18.0",
28
+ "eslint-plugin-react": "^7.37.0",
29
+ "eslint-plugin-react-hooks": "^7.1.0",
30
+ "globals": "^17.0.0",
31
+ "typescript-eslint": "^8.74.0"
32
+ },
33
+ "devDependencies": {
34
+ "eslint": "^9.39.0",
35
+ "typescript": "^5.9.0"
36
+ },
37
+ "author": "Lee Stratman",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/LeeStratman/code-standards.git",
41
+ "directory": "packages/eslint-config"
42
+ },
43
+ "homepage": "https://github.com/LeeStratman/code-standards#readme",
44
+ "keywords": [
45
+ "eslint",
46
+ "eslintconfig",
47
+ "eslint-config",
48
+ "typescript",
49
+ "react",
50
+ "nextjs",
51
+ "flat-config"
52
+ ]
53
+ }
package/react.js ADDED
@@ -0,0 +1,36 @@
1
+ import pluginReact from 'eslint-plugin-react';
2
+ import pluginReactHooks from 'eslint-plugin-react-hooks';
3
+ import globals from 'globals';
4
+ import { base } from './base.js';
5
+
6
+ /**
7
+ * base plus React. Only the two classic hook rules are on: eslint-plugin-react-hooks
8
+ * 7's React Compiler rules are worth trying per project, not forcing on all.
9
+ *
10
+ * @type {import("eslint").Linter.Config[]}
11
+ */
12
+ export const react = [
13
+ ...base,
14
+ {
15
+ ...pluginReact.configs.flat.recommended,
16
+ languageOptions: {
17
+ ...pluginReact.configs.flat.recommended.languageOptions,
18
+ globals: { ...globals.browser },
19
+ },
20
+ },
21
+ pluginReact.configs.flat['jsx-runtime'],
22
+ {
23
+ plugins: { 'react-hooks': pluginReactHooks },
24
+ settings: { react: { version: 'detect' } },
25
+ rules: {
26
+ 'react-hooks/rules-of-hooks': 'error',
27
+ 'react-hooks/exhaustive-deps': 'error',
28
+ // TypeScript checks props; PropTypes is redundant.
29
+ 'react/prop-types': 'off',
30
+ // Raw HTML needs a disable comment saying why it's safe.
31
+ 'react/no-danger': 'error',
32
+ },
33
+ },
34
+ ];
35
+
36
+ export default react;
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.