@creo-team/eslint-config 2.4.0 → 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.
Files changed (2) hide show
  1. package/README.md +71 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -77,7 +77,7 @@ module.exports = createConfig({
77
77
  "fix": "eslint . --fix"
78
78
  },
79
79
  "devDependencies": {
80
- "@creo-team/eslint-config": "^2.3.9",
80
+ "@creo-team/eslint-config": "^2.4.1",
81
81
  "eslint": "^9.39.3"
82
82
  }
83
83
  }
@@ -122,6 +122,76 @@ const base = require('@creo-team/eslint-config')
122
122
  module.exports = [...base, { rules: { 'no-console': 'warn' } }]
123
123
  ```
124
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
+
125
195
  ## Why this config
126
196
 
127
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creo-team/eslint-config",
3
- "version": "2.4.0",
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",