@lzear/eslint-config 4.0.2 → 4.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 (3) hide show
  1. package/README.md +101 -0
  2. package/dist/index.js +1 -5
  3. package/package.json +2 -3
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # @lzear/eslint-config
2
+
3
+ [![npm](https://img.shields.io/npm/v/@lzear/eslint-config)](https://www.npmjs.com/package/@lzear/eslint-config)
4
+ [![license](https://img.shields.io/npm/l/@lzear/eslint-config)](../../LICENSE)
5
+
6
+ Shared ESLint flat config for lzear repos. Includes rules for TypeScript, React, Node, Vitest, imports, accessibility, and more.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm install -D @lzear/eslint-config eslint
12
+ # or
13
+ yarn add -D @lzear/eslint-config eslint
14
+ ```
15
+
16
+ Requires Node ≥ 20, ESLint ≥ 9.
17
+
18
+ ## Usage
19
+
20
+ **Minimal `eslint.config.ts`:**
21
+
22
+ ```ts
23
+ import lzearConfig from '@lzear/eslint-config'
24
+
25
+ export default await lzearConfig()
26
+ ```
27
+
28
+ **With options** — disable feature sets you don't use:
29
+
30
+ ```ts
31
+ import lzearConfig from '@lzear/eslint-config'
32
+
33
+ export default await lzearConfig({
34
+ react: false, // not a React project
35
+ vitest: false, // no tests
36
+ })
37
+ ```
38
+
39
+ | Option | Default | Description |
40
+ |--------------|---------|------------------------------------------|
41
+ | `typescript` | `true` | TypeScript rules via `typescript-eslint` |
42
+ | `react` | `true` | React, hooks, a11y, compiler rules |
43
+ | `node` | `true` | Node.js rules via `eslint-plugin-n` |
44
+ | `vitest` | `true` | Vitest rules via `@vitest/eslint-plugin` |
45
+
46
+ **Extend with extra rules, overrides, and ignores:**
47
+
48
+ ```ts
49
+ import type { Linter } from 'eslint'
50
+ import lzearConfig from '@lzear/eslint-config'
51
+
52
+ const base = await lzearConfig({ react: false })
53
+
54
+ const config: Linter.Config[] = [
55
+ ...base,
56
+
57
+ // Extra rules applied to all files
58
+ {
59
+ rules: {
60
+ 'no-console': 'error',
61
+ 'unicorn/filename-case': ['error', { case: 'kebabCase' }],
62
+ },
63
+ },
64
+
65
+ // Turn off or downgrade specific rules
66
+ {
67
+ rules: {
68
+ 'sonarjs/cognitive-complexity': 'off',
69
+ 'import-x/order': 'warn',
70
+ },
71
+ },
72
+
73
+ // Override rules for specific files
74
+ {
75
+ files: ['scripts/**/*.ts'],
76
+ rules: {
77
+ 'no-console': 'off',
78
+ 'unicorn/no-process-exit': 'off',
79
+ },
80
+ },
81
+
82
+ // Ignore generated files and specific folders
83
+ {
84
+ ignores: [
85
+ 'src/generated/**',
86
+ 'public/**',
87
+ '**/*.min.js',
88
+ ],
89
+ },
90
+ ]
91
+
92
+ export default config
93
+ ```
94
+
95
+ ## Included plugins
96
+
97
+ `@eslint/js` · `typescript-eslint` · `eslint-plugin-unicorn` · `eslint-plugin-sonarjs` · `eslint-plugin-import-x` · `eslint-plugin-promise` · `eslint-plugin-regexp` · `eslint-plugin-react` · `eslint-plugin-react-hooks` · `eslint-plugin-jsx-a11y` · `eslint-plugin-n` · `@vitest/eslint-plugin` · `eslint-plugin-package-json` · `eslint-config-prettier` · and more.
98
+
99
+ ## Part of forge
100
+
101
+ This package is part of [forge](https://github.com/lzear/forge) — shared dev tooling for lzear repos.
package/dist/index.js CHANGED
@@ -409,6 +409,7 @@ var packageJson = () => ({
409
409
  });
410
410
 
411
411
  // configs/prettier.ts
412
+ import "eslint";
412
413
  import prettierConfig from "eslint-plugin-prettier/recommended";
413
414
  var prettier = {
414
415
  ...prettierConfig,
@@ -434,7 +435,6 @@ var react = async (config) => {
434
435
  reactHooksPlugin,
435
436
  reactPerfPlugin,
436
437
  reactPlugin,
437
- nextPlugin,
438
438
  reactXPlugin,
439
439
  reactDomPlugin,
440
440
  reactWebApiPlugin
@@ -443,7 +443,6 @@ var react = async (config) => {
443
443
  interopDefault(import("eslint-plugin-react-hooks")),
444
444
  interopDefault(import("eslint-plugin-react-perf")),
445
445
  interopDefault(import("eslint-plugin-react")),
446
- interopDefault(import("@next/eslint-plugin-next")),
447
446
  interopDefault(import("eslint-plugin-react-x")),
448
447
  interopDefault(import("eslint-plugin-react-dom")),
449
448
  interopDefault(import("eslint-plugin-react-web-api"))
@@ -456,7 +455,6 @@ var react = async (config) => {
456
455
  name: "lzear/react",
457
456
  files,
458
457
  plugins: {
459
- "@next/next": nextPlugin,
460
458
  react: reactPlugin,
461
459
  "react-compiler": reactCompilerPlugin,
462
460
  "react-dom": reactDomPlugin,
@@ -472,8 +470,6 @@ var react = async (config) => {
472
470
  "react-perf/jsx-no-new-function-as-prop": 0,
473
471
  "react-perf/jsx-no-new-object-as-prop": 0,
474
472
  ...reactPlugin.configs.recommended.rules,
475
- ...nextPlugin.configs.recommended.rules,
476
- ...nextPlugin.configs["core-web-vitals"].rules,
477
473
  "react/react-in-jsx-scope": 0,
478
474
  "react/no-unknown-property": ["error", { ignore: ["jsx", "global"] }],
479
475
  ...config.typescript ? reactXPlugin.configs["recommended-typescript"].rules : reactXPlugin.configs.recommended.rules,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lzear/eslint-config",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "description": "Shared ESLint flat config for lzear repos",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,7 +29,6 @@
29
29
  "dependencies": {
30
30
  "@eslint-community/eslint-plugin-eslint-comments": "^4",
31
31
  "@eslint/js": "^9",
32
- "@next/eslint-plugin-next": "^16",
33
32
  "@vitest/eslint-plugin": "^1",
34
33
  "eslint-config-prettier": "^10",
35
34
  "eslint-import-resolver-typescript": "^4",
@@ -58,7 +57,7 @@
58
57
  "typescript-eslint": "^8"
59
58
  },
60
59
  "devDependencies": {
61
- "@lzear/configs": "4.0.2",
60
+ "@lzear/configs": "4.1.0",
62
61
  "@vitest/coverage-v8": "^4",
63
62
  "eslint": "^9",
64
63
  "tsup": "^8",