@tuomashatakka/eslint-config 3.2.0 → 3.2.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.
|
@@ -1,59 +1,26 @@
|
|
|
1
|
-
name: Publish
|
|
1
|
+
name: Publish Package
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write # Required for OIDC
|
|
10
|
+
contents: read
|
|
7
11
|
|
|
8
12
|
jobs:
|
|
9
13
|
publish:
|
|
10
14
|
runs-on: ubuntu-latest
|
|
11
|
-
permissions:
|
|
12
|
-
contents: write
|
|
13
15
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
15
|
-
with:
|
|
16
|
-
fetch-depth: 2
|
|
17
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
16
|
+
- uses: actions/checkout@v6
|
|
18
17
|
|
|
19
|
-
-
|
|
20
|
-
id: version
|
|
21
|
-
run: |
|
|
22
|
-
CURRENT=$(jq -r .version package.json)
|
|
23
|
-
PREVIOUS=$(git show HEAD~1:package.json 2>/dev/null | jq -r .version 2>/dev/null || echo "")
|
|
24
|
-
echo "CURRENT=$CURRENT" >> "$GITHUB_OUTPUT"
|
|
25
|
-
echo "PREVIOUS=$PREVIOUS" >> "$GITHUB_OUTPUT"
|
|
26
|
-
if [ "$CURRENT" != "$PREVIOUS" ] && [ -n "$CURRENT" ]; then
|
|
27
|
-
echo "CHANGED=true" >> "$GITHUB_OUTPUT"
|
|
28
|
-
echo "Version bumped: $PREVIOUS -> $CURRENT"
|
|
29
|
-
else
|
|
30
|
-
echo "CHANGED=false" >> "$GITHUB_OUTPUT"
|
|
31
|
-
echo "No version change ($CURRENT); skipping publish."
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
- uses: actions/setup-node@v4
|
|
35
|
-
if: steps.version.outputs.CHANGED == 'true'
|
|
18
|
+
- uses: actions/setup-node@v6
|
|
36
19
|
with:
|
|
37
|
-
node-version:
|
|
38
|
-
registry-url: https://registry.npmjs.org
|
|
39
|
-
cache:
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- if: steps.version.outputs.CHANGED == 'true'
|
|
45
|
-
run: npm run test
|
|
46
|
-
|
|
47
|
-
- name: Publish to npm
|
|
48
|
-
if: steps.version.outputs.CHANGED == 'true'
|
|
49
|
-
run: npm publish --access public
|
|
50
|
-
env:
|
|
51
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
52
|
-
|
|
53
|
-
- name: Tag release
|
|
54
|
-
if: steps.version.outputs.CHANGED == 'true'
|
|
55
|
-
run: |
|
|
56
|
-
git config user.name "github-actions[bot]"
|
|
57
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
58
|
-
git tag "v${{ steps.version.outputs.CURRENT }}"
|
|
59
|
-
git push origin "v${{ steps.version.outputs.CURRENT }}"
|
|
20
|
+
node-version: '24'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
package-manager-cache: false # never use caching in release builds
|
|
23
|
+
- run: npm ci
|
|
24
|
+
- run: npm run build --if-present
|
|
25
|
+
- run: npm test
|
|
26
|
+
- run: npm publish # Or: npm stage publish
|
package/package.json
CHANGED
|
@@ -198,26 +198,34 @@ export default {
|
|
|
198
198
|
if (allAligned)
|
|
199
199
|
return
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
// Report the entire block as a single issue
|
|
202
|
+
const firstRow = subBlock[0]
|
|
203
|
+
const lastRow = subBlock[subBlock.length - 1]
|
|
204
|
+
|
|
205
|
+
context.report({
|
|
206
|
+
loc: {
|
|
207
|
+
start: firstRow.reportNode.loc.start,
|
|
208
|
+
end: lastRow.reportNode.loc.end,
|
|
209
|
+
},
|
|
210
|
+
messageId: 'misalignedAssignment',
|
|
211
|
+
fix (fixer) {
|
|
212
|
+
const fixes = []
|
|
213
|
+
for (const row of subBlock) {
|
|
214
|
+
const currentCol = row.equalsToken.loc.start.column
|
|
215
|
+
if (currentCol === targetEqualsCol)
|
|
216
|
+
continue
|
|
203
217
|
|
|
204
|
-
if (currentCol === targetEqualsCol)
|
|
205
|
-
continue
|
|
206
|
-
|
|
207
|
-
context.report({
|
|
208
|
-
node: row.reportNode,
|
|
209
|
-
messageId: 'misalignedAssignment',
|
|
210
|
-
fix (fixer) {
|
|
211
218
|
const desiredPad = targetEqualsCol - row.lhsEndCol
|
|
212
|
-
if (desiredPad
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
if (desiredPad >= 1) {
|
|
220
|
+
fixes.push(fixer.replaceTextRange(
|
|
221
|
+
[ row.lhsEndIdx, row.equalsToken.range[0] ],
|
|
222
|
+
' '.repeat(desiredPad)
|
|
223
|
+
))
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return fixes.length > 0 ? fixes : null
|
|
227
|
+
},
|
|
228
|
+
})
|
|
221
229
|
}
|
|
222
230
|
|
|
223
231
|
|
|
@@ -255,30 +263,42 @@ export default {
|
|
|
255
263
|
if (allAligned)
|
|
256
264
|
return
|
|
257
265
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
266
|
+
// Report the entire block as a single issue
|
|
267
|
+
const firstDecl = annotated[0]
|
|
268
|
+
const lastDecl = annotated[annotated.length - 1]
|
|
269
|
+
|
|
270
|
+
context.report({
|
|
271
|
+
loc: {
|
|
272
|
+
start: firstDecl.loc.start,
|
|
273
|
+
end: lastDecl.loc.end,
|
|
274
|
+
},
|
|
275
|
+
messageId: 'misalignedTypes',
|
|
276
|
+
fix (fixer) {
|
|
277
|
+
const fixes = []
|
|
278
|
+
for (const declarator of annotated) {
|
|
279
|
+
const colonCol = getTypeColonColumn(declarator)
|
|
280
|
+
|
|
281
|
+
if (colonCol === null || colonCol === maxColonCol)
|
|
282
|
+
continue
|
|
283
|
+
|
|
284
|
+
const colonToken = sourceCode.getFirstToken(declarator.id.typeAnnotation)
|
|
285
|
+
const idEndIdx = declarator.id.range[1]
|
|
286
|
+
const desiredPad = maxColonCol - colonToken.loc.start.column
|
|
287
|
+
|
|
288
|
+
if (desiredPad > 0) {
|
|
289
|
+
fixes.push(fixer.replaceTextRange(
|
|
290
|
+
[ colonToken.range[0], colonToken.range[0] ],
|
|
291
|
+
' '.repeat(desiredPad)
|
|
292
|
+
))
|
|
293
|
+
} else if (desiredPad < 0) {
|
|
294
|
+
// Colon is too far to the right, need to move it left
|
|
295
|
+
// This is more complex, so we'll skip it for now
|
|
296
|
+
continue
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return fixes.length > 0 ? fixes : null
|
|
300
|
+
},
|
|
301
|
+
})
|
|
282
302
|
}
|
|
283
303
|
|
|
284
304
|
|
package/rules.mjs
CHANGED
|
@@ -41,7 +41,7 @@ export const rules = {
|
|
|
41
41
|
'no-array-constructor': [ 'error' ],
|
|
42
42
|
'omit/omit-unnecessary-parens-brackets': [ 'warn' ],
|
|
43
43
|
'no-inline-types/no-inline-multiline-types': [ 'warn' ],
|
|
44
|
-
'whitespaced/aligned-assignments': [ 'warn', { alignTypes:
|
|
44
|
+
'whitespaced/aligned-assignments': [ 'warn', { alignTypes: false }],
|
|
45
45
|
'@stylistic/function-call-spacing': [ 'warn', 'never' ],
|
|
46
46
|
'@stylistic/computed-property-spacing': [ 'warn', 'never' ],
|
|
47
47
|
'@stylistic/brace-style': [ 'warn', 'stroustrup', { allowSingleLine: false }],
|
|
@@ -90,7 +90,7 @@ export const rules = {
|
|
|
90
90
|
'@stylistic/quotes': [ 'warn', 'single', { avoidEscape: true, allowTemplateLiterals: 'always' }],
|
|
91
91
|
'@stylistic/jsx-newline': [ 'warn', { prevent: true, allowMultilines: true }],
|
|
92
92
|
'@stylistic/jsx-equals-spacing': [ 'warn', 'never' ],
|
|
93
|
-
'@stylistic/jsx-max-props-per-line': [ 'warn', { maximum:
|
|
93
|
+
'@stylistic/jsx-max-props-per-line': [ 'warn', { maximum: 3, when: 'multiline' }],
|
|
94
94
|
'@stylistic/jsx-self-closing-comp': [ 'warn', { component: true, html: true }],
|
|
95
95
|
'@stylistic/jsx-one-expression-per-line': [ 'warn', { allow: 'non-jsx' }],
|
|
96
96
|
'@stylistic/jsx-tag-spacing': [ 'warn', { closingSlash: 'never', beforeSelfClosing: 'always', beforeClosing: 'never', afterOpening: 'never' }],
|