@creo-team/eslint-config 2.3.9 → 2.4.1

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/README.md CHANGED
@@ -49,29 +49,45 @@ module.exports = createConfig({
49
49
  Multiple packages (e.g. `app/`, `lib/`, `infra/`), each with its own `tsconfig.json`. Use **projectService** so type-aware rules resolve the nearest tsconfig per file. One `eslint.config.js` at the repo root; run `eslint .` from the root.
50
50
 
51
51
  ```javascript
52
- // eslint.config.js at monorepo root
53
52
  const { createConfig } = require('@creo-team/eslint-config')
54
53
 
55
54
  module.exports = createConfig({
56
- ignores: ['**/node_modules/**', '**/dist/**', '**/.next/**', '**/build/**'],
55
+ ignores: [
56
+ '**/node_modules/**',
57
+ '**/dist/**',
58
+ '**/.next/**',
59
+ '**/build/**',
60
+ '**/out/**',
61
+ '**/cdk.out/**',
62
+ '**/*.config.js',
63
+ '**/*.config.mjs',
64
+ '**/*.config.ts',
65
+ ],
57
66
  projectService: true,
58
67
  })
59
68
  ```
60
69
 
61
- Ensure each package that contains TypeScript has a `tsconfig.json` (or `tsconfig.eslint.json`) in that directory. No `tsconfig.eslint.json` at root is required. See [typescript-eslint project service](https://typescript-eslint.io/blog/project-service).
62
-
63
- **Root `package.json` scripts** (e.g. npm workspaces):
70
+ **Root `package.json`** (npm workspaces):
64
71
 
65
72
  ```json
66
73
  {
74
+ "workspaces": ["nextjs", "aws/infra", "shared"],
67
75
  "scripts": {
68
76
  "lint": "eslint .",
69
77
  "fix": "eslint . --fix"
78
+ },
79
+ "devDependencies": {
80
+ "@creo-team/eslint-config": "^2.4.1",
81
+ "eslint": "^9.39.3"
70
82
  }
71
83
  }
72
84
  ```
73
85
 
74
- ### 4. Monorepo per-workspace config (e.g. Vecta-style)
86
+ **Requirements:** Each package with TypeScript has a `tsconfig.json` in that directory. No root tsconfig required. See [typescript-eslint project service](https://typescript-eslint.io/blog/project-service).
87
+
88
+ **Example:** See `examples/monorepo/` in this repo. Run `cd examples/monorepo && npm install && npm run lint` to validate.
89
+
90
+ ### 4. Monorepo — per-workspace config
75
91
 
76
92
  Lint is run **per workspace** (`npm run lint -w nextjs`). Each workspace has its own `eslint.config.js` and its own `tsconfig`. Use the default preset (no `projectService`); the config runs with that workspace as cwd, so `getTsConfigFile()` finds that package’s tsconfig.
77
93
 
@@ -106,6 +122,76 @@ const base = require('@creo-team/eslint-config')
106
122
  module.exports = [...base, { rules: { 'no-console': 'warn' } }]
107
123
  ```
108
124
 
125
+ ### Customizing rules
126
+
127
+ Override any rule by spreading the base config and adding your own. Common customizations:
128
+
129
+ **1. Naming convention — allow UPPER_SNAKE for constants**
130
+
131
+ Default: `camelCase` for variables, `PascalCase` for types. To allow `UPPER_SNAKE` for constants:
132
+
133
+ ```javascript
134
+ const { createConfig } = require('@creo-team/eslint-config')
135
+
136
+ const base = createConfig()
137
+
138
+ module.exports = [
139
+ ...base,
140
+ {
141
+ files: ['**/*.ts', '**/*.tsx'],
142
+ rules: {
143
+ '@typescript-eslint/naming-convention': [
144
+ 'error',
145
+ { format: ['camelCase'], selector: 'default' },
146
+ { format: ['camelCase', 'PascalCase'], selector: 'import' },
147
+ { format: ['camelCase', 'PascalCase', 'UPPER_CASE'], selector: 'variable' },
148
+ { format: ['PascalCase'], selector: 'typeLike' },
149
+ { format: ['PascalCase'], selector: 'enumMember' },
150
+ ],
151
+ },
152
+ },
153
+ ]
154
+ ```
155
+
156
+ **2. File naming — enforce kebab-case for `.ts` / `.tsx` files**
157
+
158
+ Install [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn), then add:
159
+
160
+ ```javascript
161
+ const { createConfig } = require('@creo-team/eslint-config')
162
+ const unicorn = require('eslint-plugin-unicorn')
163
+
164
+ const base = createConfig()
165
+
166
+ module.exports = [
167
+ ...base,
168
+ {
169
+ plugins: { unicorn },
170
+ rules: {
171
+ 'unicorn/filename-case': ['error', { case: 'kebabCase' }],
172
+ },
173
+ },
174
+ ]
175
+ ```
176
+
177
+ **3. Relax JSDoc or no-magic-numbers**
178
+
179
+ ```javascript
180
+ const { createConfig } = require('@creo-team/eslint-config')
181
+
182
+ module.exports = [
183
+ ...createConfig(),
184
+ {
185
+ rules: {
186
+ 'jsdoc/require-jsdoc': 'off',
187
+ 'no-magic-numbers': 'off',
188
+ },
189
+ },
190
+ ]
191
+ ```
192
+
193
+ **Examples:** See `examples/rule-overrides/` for working configs and tests.
194
+
109
195
  ## Why this config
110
196
 
111
197
  **Predictable, reviewable code.** The rules are chosen so that style is decided once (Prettier + stylistic), intent is documented (JSDoc), and structure stays within bounds (complexity, line limits, no magic numbers). That reduces pointless formatting debates and makes diffs easier to read.
@@ -139,7 +225,11 @@ For folder/file structure enforcement, add [eslint-plugin-project-structure](htt
139
225
 
140
226
  ## Release flow
141
227
 
142
- Trunk-based. Bump `version` in `package.json`, push `main` → `github-release` creates tag → `npm-publish` publishes. OIDC, no tokens. Release runs only when `package.json` changes.
228
+ Trunk-based. Bump `version` in `package.json`, push `main` → `github-release` creates tag + GitHub Release → `npm-publish` publishes to npm. OIDC Trusted Publishing, no tokens.
229
+
230
+ ## Examples
231
+
232
+ - **Monorepo:** `examples/monorepo/` — root config with `projectService`, npm workspaces. See [examples/README.md](./examples/README.md).
143
233
 
144
234
  ## Development
145
235
 
@@ -64,6 +64,6 @@ function createConfig(options = {}) {
64
64
  },
65
65
  });
66
66
  }
67
- module.exports = createConfig();
67
+ module.exports = createConfig({ ignores: ['dist/**', 'test/**', 'examples/**'] });
68
68
  module.exports.createConfig = createConfig;
69
69
  //# sourceMappingURL=eslint.config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eslint.config.js","sourceRoot":"","sources":["../eslint.config.js"],"names":[],"mappings":";AAEA,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AACpC,MAAM,eAAe,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;AAC3D,MAAM,YAAY,GAAG,OAAO,CAAC,sBAAsB,CAAC,C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AE,SAAS,EAAE,aAAa,CAAC,EAAE,CAAC,CAAA;AACjF,MAAM,CAAC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creo-team/eslint-config",
3
- "version": "2.3.9",
3
+ "version": "2.4.1",
4
4
  "description": "ESLint flat config: TypeScript (strict), Prettier, JSDoc, complexity, no-magic-numbers. createConfig() for options.",
5
5
  "author": "Colten Krauter <coltenkrauter>",
6
6
  "main": "dist/eslint.config.js",