Skip to content

Commit 5ec93d7

Browse files
committed
style: 🚨 Use eslint and separate config files
embedding configs in package.json has proven less reliable than separate config files as tools have updated over time fixing the configs revealed a handful of linting errors xo is still great for including many strict rules, but eslint actually works more reliably xo is still used for eslint rules npm-package-json-lint seemed to stop working entirely but keeping prettier-plugin-packagejson seems to do all we need Signed-off-by: Eric Nemchik <[email protected]>
1 parent d261b49 commit 5ec93d7

25 files changed

+416
-810
lines changed

.eslintrc.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"extends": [
3+
"plugin:unicorn/recommended",
4+
"plugin:import/recommended",
5+
"plugin:import/typescript",
6+
"plugin:n/recommended",
7+
"xo",
8+
"xo-typescript/space",
9+
"prettier"
10+
],
11+
"settings": {
12+
"import/resolver": {
13+
"typescript": true,
14+
"node": true
15+
}
16+
},
17+
"rules": {
18+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
19+
"unicorn/filename-case": [
20+
"error",
21+
{
22+
"case": "camelCase",
23+
"ignore": ["^lint-staged\\.config\\.js$"]
24+
}
25+
],
26+
"import/order": [
27+
"error",
28+
{
29+
"groups": [["builtin", "external"], "parent", "sibling", "index"]
30+
}
31+
]
32+
}
33+
}

.github/workflows/docker-publish.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: Docker
22

33
on:
44
push:
5-
branches: [ "main", "unstable" ]
5+
branches: ['main', 'unstable']
66
# Publish semver tags as releases.
7-
tags: [ 'v*.*' ]
7+
tags: ['v*.*']
88
pull_request:
9-
branches: [ "main" ]
9+
branches: ['main']
1010

1111
env:
1212
# Use docker.io for Docker Hub if empty
@@ -16,7 +16,6 @@ env:
1616

1717
jobs:
1818
build:
19-
2019
runs-on: ubuntu-latest
2120
permissions:
2221
contents: read
@@ -62,4 +61,4 @@ jobs:
6261
tags: ${{ steps.meta.outputs.tags }}
6362
labels: ${{ steps.meta.outputs.labels }}
6463
cache-from: type=gha
65-
cache-to: type=gha,mode=max
64+
cache-to: type=gha,mode=max

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"recommendations": [
33
"aaron-bond.better-comments",
4+
"dbaeumer.vscode-eslint",
45
"editorconfig.editorconfig",
56
"esbenp.prettier-vscode",
6-
"samverschueren.linter-xo",
77
"streetsidesoftware.code-spell-checker"
88
]
99
}

lint-staged.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @see https://github.com/lint-staged/lint-staged?tab=readme-ov-file#using-js-configuration-files
3+
* @type {import('lint-staged').Config}
4+
*/
5+
6+
export default {
7+
// eslint-disable-next-line @typescript-eslint/naming-convention
8+
'*': (filenames) => filenames.map((filename) => `prettier --ignore-unknown --write '${filename}'`),
9+
};

0 commit comments

Comments
 (0)