airier 0.0.8 → 0.0.10
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/AGENTS.md +319 -0
- package/LICENSE +1 -1
- package/README.md +42 -6
- package/eslint.config.example.js +3 -0
- package/eslint.config.js +4 -0
- package/index.js +6 -0
- package/modules/eslint_config.js +56 -0
- package/modules/{styleguide.cjs → styleguide.js} +3 -6
- package/package.json +31 -7
- package/.eslintrc.cjs +0 -7
- package/.eslintrc.onlystyles.example.js +0 -6
- package/.husky/pre-commit +0 -21
- package/.vscode/settings.json +0 -27
- package/index.cjs +0 -6
- package/modules/eslint_config.cjs +0 -50
package/AGENTS.md
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# AI Coding Assistant Instructions
|
|
2
|
+
|
|
3
|
+
Write code that breathes. Think Ruby-like elegance meets modern JavaScript. Every character should earn its place.
|
|
4
|
+
|
|
5
|
+
## Philosophy: Airy, Minimalist Code
|
|
6
|
+
|
|
7
|
+
- **Minimalism First**: Don't add features that weren't requested. Three similar lines beats a premature abstraction. If unused, delete completely.
|
|
8
|
+
- **Readability Through Spacing**: Code needs room to breathe. Spacing makes structure visible at a glance.
|
|
9
|
+
- **Modern JavaScript Only**: Use `const`/`let`, arrow functions, destructuring, template literals, ES modules.
|
|
10
|
+
|
|
11
|
+
## Critical Style Rules
|
|
12
|
+
|
|
13
|
+
### 1. No Semicolons (Non-negotiable)
|
|
14
|
+
```javascript
|
|
15
|
+
// ✅ CORRECT
|
|
16
|
+
const x = 5
|
|
17
|
+
return x + y
|
|
18
|
+
|
|
19
|
+
// ❌ WRONG
|
|
20
|
+
const x = 5;
|
|
21
|
+
return x + y;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 2. Spacing Everywhere
|
|
25
|
+
```javascript
|
|
26
|
+
// ✅ CORRECT - Airy and readable
|
|
27
|
+
const arr = [ 1, 2, 3 ]
|
|
28
|
+
const obj = { foo: 'bar' }
|
|
29
|
+
const result = my_func( arg1, arg2 )
|
|
30
|
+
if( condition ) {
|
|
31
|
+
console.log( `Value: ${ variable }` )
|
|
32
|
+
}
|
|
33
|
+
const arrow = ( a, b ) => a + b
|
|
34
|
+
|
|
35
|
+
// ❌ WRONG - Cramped
|
|
36
|
+
const arr = [1, 2, 3]
|
|
37
|
+
const obj = {foo: 'bar'}
|
|
38
|
+
const result = myFunc(arg1, arg2)
|
|
39
|
+
if(condition) {
|
|
40
|
+
console.log(`Value: ${variable}`)
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 3. snake_case for Everything
|
|
45
|
+
```javascript
|
|
46
|
+
// ✅ CORRECT
|
|
47
|
+
const timeout_ms = 5000
|
|
48
|
+
const user_name = 'John'
|
|
49
|
+
const add_numbers = ( a, b ) => a + b
|
|
50
|
+
const fetch_user_data = async ( user_id ) => { }
|
|
51
|
+
|
|
52
|
+
// ❌ WRONG - camelCase
|
|
53
|
+
const timeoutMs = 5000
|
|
54
|
+
const userName = 'John'
|
|
55
|
+
const addNumbers = ( a, b ) => a + b
|
|
56
|
+
const fetchUserData = async ( userId ) => { }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 4. Keywords: No Space After
|
|
60
|
+
```javascript
|
|
61
|
+
// ✅ CORRECT
|
|
62
|
+
if( x > 5 ) { }
|
|
63
|
+
for( let i = 0; i < 10; i++ ) { }
|
|
64
|
+
while( condition ) { }
|
|
65
|
+
|
|
66
|
+
// ❌ WRONG
|
|
67
|
+
if (x > 5) { }
|
|
68
|
+
for (let i = 0; i < 10; i++) { }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 5. Indentation: 4 Spaces
|
|
72
|
+
```javascript
|
|
73
|
+
// ✅ CORRECT
|
|
74
|
+
const process_data = ( data ) => {
|
|
75
|
+
const filtered = data.filter( item => item.active )
|
|
76
|
+
return filtered
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ❌ WRONG - 2 spaces
|
|
80
|
+
const process_data = ( data ) => {
|
|
81
|
+
const filtered = data.filter( item => item.active )
|
|
82
|
+
return filtered
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Spacing Quick Reference
|
|
87
|
+
|
|
88
|
+
| Element | Pattern | Example |
|
|
89
|
+
|---------|---------|---------|
|
|
90
|
+
| Arrays | `[ items ]` | `[ 1, 2, 3 ]` |
|
|
91
|
+
| Objects | `{ key: value }` | `{ foo: 'bar' }` |
|
|
92
|
+
| Function calls | `func( args )` | `my_func( a, b )` |
|
|
93
|
+
| Arrow functions | `( args ) => { }` | `const fn = ( x ) => x * 2` |
|
|
94
|
+
| Template literals | `${ expr }` | `` `Hello ${ name }` `` |
|
|
95
|
+
| Blocks | `keyword( cond ) {` | `if( x > 5 ) {` |
|
|
96
|
+
|
|
97
|
+
## React Specific
|
|
98
|
+
```javascript
|
|
99
|
+
// ✅ CORRECT
|
|
100
|
+
<Component prop={ value } />
|
|
101
|
+
<div className="foo">{ children }</div>
|
|
102
|
+
|
|
103
|
+
// ❌ WRONG
|
|
104
|
+
<Component prop={value} />
|
|
105
|
+
<div className="foo">{children}</div>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- No `import React from 'react'` needed (modern React)
|
|
109
|
+
- Prefer functional components with hooks
|
|
110
|
+
- PropTypes optional (use TypeScript if you need types)
|
|
111
|
+
|
|
112
|
+
## Minimalism Rules
|
|
113
|
+
|
|
114
|
+
### ❌ Don't Over-Engineer
|
|
115
|
+
```javascript
|
|
116
|
+
// ❌ WRONG
|
|
117
|
+
const create_greeting = ( config ) => {
|
|
118
|
+
const { name, formal = false } = config
|
|
119
|
+
return formal ? `Hello, ${ name }` : `Hey ${ name }`
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ✅ CORRECT
|
|
123
|
+
const greet = ( name ) => `Hello, ${ name }`
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### ❌ Don't Add Unrequested Features
|
|
127
|
+
```javascript
|
|
128
|
+
// ❌ WRONG - validation, logging, backup not requested
|
|
129
|
+
const save_user = ( user, options = {} ) => {
|
|
130
|
+
if( options.validate ) validate( user )
|
|
131
|
+
if( options.log ) console.log( user )
|
|
132
|
+
return db.save( user )
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ✅ CORRECT
|
|
136
|
+
const save_user = ( user ) => db.save( user )
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Functional Programming Over Loops
|
|
140
|
+
|
|
141
|
+
Prefer higher-level array methods over primitive loops. They're more readable and declarative.
|
|
142
|
+
|
|
143
|
+
```javascript
|
|
144
|
+
// ✅ CORRECT - Functional approach
|
|
145
|
+
const active_users = users.filter( u => u.active )
|
|
146
|
+
const user_names = users.map( u => u.name )
|
|
147
|
+
const total = numbers.reduce( ( sum, n ) => sum + n, 0 )
|
|
148
|
+
|
|
149
|
+
// ❌ WRONG - Primitive loops
|
|
150
|
+
const active_users = []
|
|
151
|
+
for( let i = 0; i < users.length; i++ ) {
|
|
152
|
+
if( users[i].active ) {
|
|
153
|
+
active_users.push( users[i] )
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Prefer in order**: `.map()`, `.filter()`, `.reduce()`, `.find()`, `.some()`, `.every()` over `for`/`while` loops.
|
|
159
|
+
|
|
160
|
+
## JSDoc for Exported Functions
|
|
161
|
+
|
|
162
|
+
**CRITICAL**: Every exported function MUST have JSDoc comments. Before finishing, always verify JSDoc is present and up-to-date for all changed exports.
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
// ✅ CORRECT
|
|
166
|
+
/**
|
|
167
|
+
* Fetches user data from the API
|
|
168
|
+
* @param {string} user_id - The ID of the user to fetch
|
|
169
|
+
* @returns {Promise<Object>} User data object
|
|
170
|
+
*/
|
|
171
|
+
export const fetch_user = async ( user_id ) => {
|
|
172
|
+
const response = await api.get( `/users/${ user_id }` )
|
|
173
|
+
return response.data
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// ❌ WRONG - No JSDoc
|
|
177
|
+
export const fetch_user = async ( user_id ) => {
|
|
178
|
+
const response = await api.get( `/users/${ user_id }` )
|
|
179
|
+
return response.data
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Before completing any task**: Review all modified exports and ensure their JSDoc is accurate and current.
|
|
184
|
+
|
|
185
|
+
## Error Handling
|
|
186
|
+
|
|
187
|
+
Only at boundaries (user input, external APIs). Trust internal code.
|
|
188
|
+
|
|
189
|
+
**IMPORTANT**: Remember the `finally` block! It's perfect for cleanup operations and runs regardless of success/failure.
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
// ✅ CORRECT - Using finally for cleanup
|
|
193
|
+
const fetch_user = async ( id ) => {
|
|
194
|
+
const loading_indicator = start_loading()
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
const response = await api.get( `/users/${ id }` )
|
|
198
|
+
return response.data
|
|
199
|
+
} catch( error ) {
|
|
200
|
+
throw new Error( `Failed to fetch user: ${ error.message }` )
|
|
201
|
+
} finally {
|
|
202
|
+
// Always runs - perfect for cleanup
|
|
203
|
+
stop_loading( loading_indicator )
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Also valid - Simple boundary error handling
|
|
208
|
+
const get_user = async ( id ) => {
|
|
209
|
+
try {
|
|
210
|
+
const response = await api.get( `/users/${ id }` )
|
|
211
|
+
return response.data
|
|
212
|
+
} catch( error ) {
|
|
213
|
+
throw new Error( `Failed to fetch user: ${ error.message }` )
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Internal functions trust their callers
|
|
218
|
+
const process_user = ( user ) => user.name.toUpperCase()
|
|
219
|
+
|
|
220
|
+
// ❌ WRONG - Defensive programming everywhere
|
|
221
|
+
const process_user = ( user ) => {
|
|
222
|
+
if( !user || !user.name ) return null
|
|
223
|
+
return user.name.toUpperCase()
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Using Mentie Helpers (If Installed)
|
|
228
|
+
|
|
229
|
+
If the `mentie` package is installed in the project, **always use its utilities** instead of reinventing them.
|
|
230
|
+
|
|
231
|
+
**IMPORTANT**: Check `node_modules/mentie/index.js` (or the package's main export file) to see all available exports and their usage before implementing any utility functions yourself.
|
|
232
|
+
|
|
233
|
+
### Logging with `log`
|
|
234
|
+
```javascript
|
|
235
|
+
import { log } from 'mentie'
|
|
236
|
+
|
|
237
|
+
// ✅ CORRECT - Use mentie's structured logging
|
|
238
|
+
log.info( 'User logged in:', user_id )
|
|
239
|
+
log.debug( 'Processing data:', data )
|
|
240
|
+
log.insane( 'Detailed trace:', complex_object )
|
|
241
|
+
|
|
242
|
+
// ❌ WRONG - Don't use console.log when mentie is available
|
|
243
|
+
console.log( 'User logged in:', user_id )
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### String Utilities
|
|
247
|
+
```javascript
|
|
248
|
+
import { multiline_trim } from 'mentie'
|
|
249
|
+
|
|
250
|
+
// ✅ CORRECT - Clean multiline strings
|
|
251
|
+
const query = multiline_trim( `
|
|
252
|
+
SELECT *
|
|
253
|
+
FROM users
|
|
254
|
+
WHERE active = true
|
|
255
|
+
` )
|
|
256
|
+
|
|
257
|
+
// ❌ WRONG - Manual string manipulation
|
|
258
|
+
const query = `SELECT * FROM users WHERE active = true`
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Array Utilities
|
|
262
|
+
```javascript
|
|
263
|
+
import { shuffle_array } from 'mentie'
|
|
264
|
+
|
|
265
|
+
// ✅ CORRECT - Use mentie's shuffle
|
|
266
|
+
const randomized = shuffle_array( items )
|
|
267
|
+
|
|
268
|
+
// ❌ WRONG - Implementing your own shuffle
|
|
269
|
+
const randomized = items.sort( () => Math.random() - 0.5 )
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Check for mentie**:
|
|
273
|
+
1. Look in `package.json` dependencies to see if mentie is installed
|
|
274
|
+
2. If present, read `node_modules/mentie/index.js` to see all available exports
|
|
275
|
+
3. Use mentie's utilities instead of reimplementing them
|
|
276
|
+
|
|
277
|
+
## Complete Example
|
|
278
|
+
|
|
279
|
+
```javascript
|
|
280
|
+
/**
|
|
281
|
+
* Fetches and processes users from the API
|
|
282
|
+
* @param {Object} filters - Query filters to apply
|
|
283
|
+
* @returns {Promise<Array>} Processed user objects with id, name, and email
|
|
284
|
+
*/
|
|
285
|
+
const fetch_and_process_users = async ( filters = {} ) => {
|
|
286
|
+
const users = await api.get( '/users', { params: filters } )
|
|
287
|
+
|
|
288
|
+
const processed = users
|
|
289
|
+
.filter( user => user.active )
|
|
290
|
+
.map( user => ( {
|
|
291
|
+
id: user.id,
|
|
292
|
+
name: user.name,
|
|
293
|
+
email: user.email
|
|
294
|
+
} ) )
|
|
295
|
+
|
|
296
|
+
return processed
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export default fetch_and_process_users
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Checklist
|
|
303
|
+
|
|
304
|
+
- [ ] No semicolons
|
|
305
|
+
- [ ] Spacing in all brackets: `[ ]`, `{ }`, `( )`, `${ }`
|
|
306
|
+
- [ ] snake_case for all variables and functions
|
|
307
|
+
- [ ] 4-space indentation
|
|
308
|
+
- [ ] `const`/`let` only (never `var`)
|
|
309
|
+
- [ ] Arrow functions preferred
|
|
310
|
+
- [ ] Higher-level functions (.map, .filter, .reduce) over loops
|
|
311
|
+
- [ ] JSDoc on ALL exported functions (verify before finishing!)
|
|
312
|
+
- [ ] Consider `finally` block for cleanup in try/catch
|
|
313
|
+
- [ ] Check if `mentie` is installed and use its helpers (log, multiline_trim, etc.)
|
|
314
|
+
- [ ] No unnecessary features or abstractions
|
|
315
|
+
- [ ] Dead code completely removed
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
**Remember**: Code is read far more than it's written. Make it beautiful, make it breathe, make it obvious.
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
A shared set of standards and preferences, enforced through eslint and vscode. Priorities: minimalism, readability, documentation.
|
|
4
4
|
|
|
5
|
+
**Now updated for ESLint 9.x with flat config format and ESM support!**
|
|
6
|
+
|
|
5
7
|
## Quickstart
|
|
6
8
|
|
|
7
9
|
```shell
|
|
8
10
|
# Install dependencies
|
|
9
|
-
npm install -D airier
|
|
11
|
+
npm install -D airier husky
|
|
10
12
|
mkdir .vscode .husky || echo "Directories already exist"
|
|
11
13
|
|
|
12
14
|
# Create scripts
|
|
@@ -15,20 +17,55 @@ npm pkg set scripts.lint="eslint --fix src"
|
|
|
15
17
|
# Init husky
|
|
16
18
|
npx husky init
|
|
17
19
|
|
|
18
|
-
# Download files
|
|
19
|
-
curl https://raw.githubusercontent.com/actuallymentor/airier/main
|
|
20
|
+
# Download files (using new ESLint 9 flat config format)
|
|
21
|
+
curl https://raw.githubusercontent.com/actuallymentor/airier/main/eslint.config.js --output eslint.config.js
|
|
20
22
|
curl https://raw.githubusercontent.com/actuallymentor/airier/main/.vscode/settings.json --output .vscode/settings.json
|
|
21
23
|
curl https://raw.githubusercontent.com/actuallymentor/airier/main/.husky/pre-commit --output .husky/pre-commit
|
|
22
24
|
curl https://raw.githubusercontent.com/actuallymentor/airier/main/.babelrc --output .babelrc
|
|
25
|
+
curl https://raw.githubusercontent.com/actuallymentor/airier/main/AGENTS.md --output AGENTS.md
|
|
26
|
+
|
|
27
|
+
# Ensure .gitignore ignores all dotfiles by default
|
|
28
|
+
grep -q '^\.\*$' .gitignore || echo -e "\n# Dotfiles\n.*" >> .gitignore
|
|
23
29
|
|
|
24
30
|
# Add files to git
|
|
25
|
-
git add -f .
|
|
31
|
+
git add -f eslint.config.js .babelrc AGENTS.md .vscode/* .husky/*
|
|
26
32
|
|
|
27
33
|
# Make husky executable
|
|
28
34
|
chmod ug+x .husky/*
|
|
29
|
-
git add .husky/pre-commit
|
|
35
|
+
git add -f .husky/pre-commit
|
|
30
36
|
```
|
|
31
37
|
|
|
38
|
+
## ESLint 9 Migration
|
|
39
|
+
|
|
40
|
+
This package now uses ESLint 9.x with the new **flat config format** and **ESM-only**. If you're upgrading from an older version:
|
|
41
|
+
|
|
42
|
+
1. Remove your old `.eslintrc.*` files (they're no longer supported in ESLint 9)
|
|
43
|
+
2. Use `eslint.config.js` instead
|
|
44
|
+
3. Update your ESLint to version 9.39.2 or later
|
|
45
|
+
4. Ensure your project supports ESM (Node.js 20+)
|
|
46
|
+
|
|
47
|
+
### Usage
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
// eslint.config.js
|
|
51
|
+
import { eslint_config } from 'airier'
|
|
52
|
+
|
|
53
|
+
export default eslint_config
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## AI Assistant Instructions
|
|
57
|
+
|
|
58
|
+
This package includes an `AGENTS.md` file that instructs AI coding assistants (like Claude, GPT, Copilot) to follow the same minimalist, "airy" code style that the ESLint rules enforce.
|
|
59
|
+
|
|
60
|
+
When working with AI assistants, share this file with them to ensure they write code matching your style:
|
|
61
|
+
- No semicolons
|
|
62
|
+
- Spacing in brackets: `[ 1, 2, 3 ]`, `{ key: value }`, `func( args )`
|
|
63
|
+
- 4-space indentation
|
|
64
|
+
- Minimalist, Ruby-like aesthetics
|
|
65
|
+
- Modern ES modules only
|
|
66
|
+
|
|
67
|
+
The AI instructions complement the automated linting by teaching assistants *why* the code should look this way, not just enforcing it after the fact.
|
|
68
|
+
|
|
32
69
|
## Making changes
|
|
33
70
|
|
|
34
71
|
The relevant source files are in `modules/`. If you make a change, you can update the package by:
|
|
@@ -43,4 +80,3 @@ If you are cloning this repo and want to reuse it to create an npm package. Thes
|
|
|
43
80
|
|
|
44
81
|
1. You need to do the one-time first publishing manually by running `npm publish --access public` in the root of the project. This will create the package on npmjs and allow you to create a granular token. This requires you to rename `.npmrc` to `.npmrc.bak` temporatily.
|
|
45
82
|
1. You need to obtain a NPM_ACCESS_TOKEN on npmjs (https://www.npmjs.com/settings/YOURUSERNAME/tokens/granular-access-tokens/new). Note that granular tokens expire!
|
|
46
|
-
# airier
|
package/eslint.config.js
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Import required modules
|
|
2
|
+
import eslint from '@eslint/js'
|
|
3
|
+
import react from 'eslint-plugin-react'
|
|
4
|
+
import unusedImports from 'eslint-plugin-unused-imports'
|
|
5
|
+
import babelParser from '@babel/eslint-parser'
|
|
6
|
+
import globals from 'globals'
|
|
7
|
+
|
|
8
|
+
// Import the styleguide module
|
|
9
|
+
import styleguide from './styleguide.js'
|
|
10
|
+
|
|
11
|
+
// Export the flat config as an array
|
|
12
|
+
export default [
|
|
13
|
+
// Apply to all JavaScript and JSX files
|
|
14
|
+
{
|
|
15
|
+
files: [ '**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs' ],
|
|
16
|
+
|
|
17
|
+
languageOptions: {
|
|
18
|
+
parser: babelParser,
|
|
19
|
+
parserOptions: {
|
|
20
|
+
ecmaVersion: 2020,
|
|
21
|
+
requireConfigFile: false,
|
|
22
|
+
ecmaFeatures: {
|
|
23
|
+
jsx: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
globals: {
|
|
27
|
+
...globals.browser,
|
|
28
|
+
...globals.node,
|
|
29
|
+
...globals.mocha,
|
|
30
|
+
...globals.cypress
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
plugins: {
|
|
35
|
+
react,
|
|
36
|
+
'unused-imports': unusedImports
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
settings: {
|
|
40
|
+
react: {
|
|
41
|
+
version: 'detect'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
rules: {
|
|
46
|
+
// ESLint recommended rules
|
|
47
|
+
...eslint.configs.recommended.rules,
|
|
48
|
+
|
|
49
|
+
// React recommended rules
|
|
50
|
+
...react.configs.recommended.rules,
|
|
51
|
+
|
|
52
|
+
// Custom styleguide rules
|
|
53
|
+
...styleguide
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// warn: we recomment this to change, but there are instances where you can choose to ignore it
|
|
4
4
|
// error: there is no reason for you to do this
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export default {
|
|
7
7
|
|
|
8
8
|
/* ///////////////////////////////
|
|
9
9
|
// Built-in rules
|
|
@@ -15,9 +15,6 @@ module.exports = {
|
|
|
15
15
|
// Indentation setting
|
|
16
16
|
"indent": [ "warn", 4 ],
|
|
17
17
|
|
|
18
|
-
// Allow unnamed exports
|
|
19
|
-
"import/no-anonymous-default-export": 0,
|
|
20
|
-
|
|
21
18
|
// Prefer arrow callbacks
|
|
22
19
|
"prefer-arrow-callback": "warn",
|
|
23
20
|
|
|
@@ -56,7 +53,7 @@ module.exports = {
|
|
|
56
53
|
// Prefer the use of destructuring
|
|
57
54
|
"prefer-destructuring": "warn",
|
|
58
55
|
|
|
59
|
-
// Warn of unused variables, function
|
|
56
|
+
// Warn of unused variables, function arguments may have documentation value so are ignored
|
|
60
57
|
"no-unused-vars": [ "warn", { vars: 'all', args: 'none' } ],
|
|
61
58
|
|
|
62
59
|
// No use of "var"
|
|
@@ -93,4 +90,4 @@ module.exports = {
|
|
|
93
90
|
// /////////////////////////////*/
|
|
94
91
|
"unused-imports/no-unused-imports": "warn",
|
|
95
92
|
|
|
96
|
-
}
|
|
93
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "airier",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Opinionated Eslint and VSCode style guide",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"lint": "eslint --fix ."
|
|
8
9
|
},
|
|
@@ -16,12 +17,35 @@
|
|
|
16
17
|
"url": "https://github.com/actuallymentor/airier/issues"
|
|
17
18
|
},
|
|
18
19
|
"homepage": "https://github.com/actuallymentor/airier#readme",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20.0.0"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"eslint",
|
|
25
|
+
"eslint-config",
|
|
26
|
+
"style-guide",
|
|
27
|
+
"code-style",
|
|
28
|
+
"javascript",
|
|
29
|
+
"react",
|
|
30
|
+
"minimalist",
|
|
31
|
+
"airy"
|
|
32
|
+
],
|
|
33
|
+
"files": [
|
|
34
|
+
"index.js",
|
|
35
|
+
"modules/",
|
|
36
|
+
".babelrc",
|
|
37
|
+
"eslint.config.js",
|
|
38
|
+
"eslint.config.example.js",
|
|
39
|
+
"AGENTS.md"
|
|
40
|
+
],
|
|
19
41
|
"peerDependencies": {
|
|
20
|
-
"eslint-
|
|
21
|
-
"@babel/eslint-parser": "^7.24.1",
|
|
42
|
+
"@babel/eslint-parser": "^7.28.5",
|
|
22
43
|
"@babel/preset-react": "^7.24.1",
|
|
23
|
-
"eslint": "^
|
|
24
|
-
"eslint
|
|
44
|
+
"@eslint/js": "^9.39.2",
|
|
45
|
+
"eslint": "^9.39.2",
|
|
46
|
+
"eslint-plugin-react": "^7.37.5",
|
|
47
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
48
|
+
"globals": "^15.0.0",
|
|
25
49
|
"husky": "^9.0.11"
|
|
26
50
|
}
|
|
27
|
-
}
|
|
51
|
+
}
|
package/.eslintrc.cjs
DELETED
package/.husky/pre-commit
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
-
|
|
4
|
-
echo "\n🤖 [ precommit hook ] linting before committing..."
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# If errors, make it clear they cannot commit
|
|
8
|
-
if ! lint_outcome=$( npm run lint ); then
|
|
9
|
-
echo "🚨 [ precommit hook ] lint encountered blocking issues, fix them before committing\n"
|
|
10
|
-
echo "$lint_outcome"
|
|
11
|
-
exit 1
|
|
12
|
-
fi
|
|
13
|
-
|
|
14
|
-
# If warnings, suggest they fix them
|
|
15
|
-
if echo $lint_outcome | grep -q "warning"; then
|
|
16
|
-
echo "⚠️ [ precommit hook ] lint encountered warnings, consider fixing them before pushing\n"
|
|
17
|
-
echo "$lint_outcome"
|
|
18
|
-
exit 0
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
echo "✅ [ precommit hook ] lint encountered no blocking issues\n"
|
package/.vscode/settings.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"i18n-ally.localesPaths": [
|
|
3
|
-
"public/locales"
|
|
4
|
-
],
|
|
5
|
-
"i18n-ally.keystyle": "nested",
|
|
6
|
-
"eslint.validate": [
|
|
7
|
-
"javascript",
|
|
8
|
-
"javascriptreact",
|
|
9
|
-
"typescript",
|
|
10
|
-
"typescriptreact"
|
|
11
|
-
],
|
|
12
|
-
"editor.codeActionsOnSave": {
|
|
13
|
-
"source.fixAll.eslint": "explicit"
|
|
14
|
-
},
|
|
15
|
-
"editor.renderWhitespace": "all",
|
|
16
|
-
"editor.formatOnSave": true,
|
|
17
|
-
"eslint.format.enable": true,
|
|
18
|
-
"eslint.run": "onType",
|
|
19
|
-
"explorer.fileNesting.enabled": true,
|
|
20
|
-
"explorer.fileNesting.patterns": {
|
|
21
|
-
"vite.config.js": "*.js,.babelrc,.nvmrc,index.html,.gitignore",
|
|
22
|
-
".env": ".env*,.*.json",
|
|
23
|
-
"firebase.json": "fire*,.fire*",
|
|
24
|
-
"package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml,.eslint*,config.*,.npm*,.nvm*,.ncu*",
|
|
25
|
-
"README.md": "*.md,LICENSE",
|
|
26
|
-
}
|
|
27
|
-
}
|
package/index.cjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Import the styleguide module using ES Module syntax
|
|
2
|
-
const styleguide = require( './styleguide.cjs' )
|
|
3
|
-
|
|
4
|
-
// Export the configuration object using `export default`
|
|
5
|
-
module.exports = {
|
|
6
|
-
|
|
7
|
-
// Recommended features
|
|
8
|
-
"extends": [ "eslint:recommended", "plugin:react/recommended" ],
|
|
9
|
-
|
|
10
|
-
// Plugins
|
|
11
|
-
plugins: [ 'unused-imports' ],
|
|
12
|
-
|
|
13
|
-
// React settings
|
|
14
|
-
"settings": {
|
|
15
|
-
"react": { "version": "detect" }
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
// Parser features
|
|
19
|
-
parser: "@babel/eslint-parser",
|
|
20
|
-
parserOptions: {
|
|
21
|
-
requireConfigFile: false,
|
|
22
|
-
ecmaFeatures: {
|
|
23
|
-
jsx: true
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
// Rules
|
|
28
|
-
rules: {
|
|
29
|
-
// Import styleguide
|
|
30
|
-
...styleguide
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
// What environment to run in
|
|
34
|
-
env: {
|
|
35
|
-
node: true,
|
|
36
|
-
browser: true,
|
|
37
|
-
mocha: true,
|
|
38
|
-
jest: false,
|
|
39
|
-
es6: true
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
// What global variables should be assumed to exist
|
|
43
|
-
globals: {
|
|
44
|
-
context: true,
|
|
45
|
-
cy: true,
|
|
46
|
-
it: true,
|
|
47
|
-
Cypress: true,
|
|
48
|
-
expect: true
|
|
49
|
-
}
|
|
50
|
-
}
|