Skip to content

Commit b6560e6

Browse files
feat: upgrade deps, move to ESLint flat config 🚀
1 parent 5c3bfe0 commit b6560e6

7 files changed

+8525
-6086
lines changed

‎.eslintrc.js

-70
This file was deleted.

‎.vscode/settings.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
"files.trimTrailingWhitespace": true,
2121
"typescript.tsdk": "node_modules/typescript/lib",
2222
"typescript.enablePromptUseWorkspaceTsdk": true,
23-
"eslint.lintTask.options": "--cache --ext js,ts .",
23+
"eslint.lintTask.options": "--cache --config eslint.config.mjs .",
24+
"eslint.experimental.useFlatConfig": true,
25+
"eslint.options": {
26+
"overrideConfigFile": "eslint.config.mjs",
27+
},
2428
"mochaExplorer.files": "{src,test}/**/*.test.js"
2529
}

‎eslint.config.mjs

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import * as os from 'os'
2+
import nodev20 from '@strv/eslint-config-node/v20'
3+
import nodeopt from '@strv/eslint-config-node/optional'
4+
import nodestyle from '@strv/eslint-config-node/style'
5+
import ts from '@strv/eslint-config-typescript'
6+
import tsoptional from '@strv/eslint-config-typescript/optional'
7+
import tsstyle from '@strv/eslint-config-typescript/style'
8+
import mocha from '@strv/eslint-config-mocha'
9+
10+
const lbstyle = os.platform() === 'win32' ? 'windows' : 'unix'
11+
const globs = {
12+
mjs: '**/*.mjs',
13+
ts: '**/*.ts',
14+
tests: '**/*.test.ts',
15+
}
16+
17+
/** @type {Array<import("eslint").Linter.FlatConfig>} */
18+
const config = [
19+
{ linterOptions: {
20+
reportUnusedDisableDirectives: true,
21+
} },
22+
{ ignores: ['**/*.js', '**/*.d.ts', 'node_modules'] },
23+
{ files: [globs.ts, globs.mjs], ...nodev20 },
24+
{ files: [globs.ts, globs.mjs], ...nodeopt },
25+
{ files: [globs.ts, globs.mjs], ...nodestyle },
26+
27+
{ files: [globs.ts], ...ts },
28+
{ files: [globs.ts], ...tsoptional },
29+
{ files: [globs.ts], ...tsstyle },
30+
31+
{ files: [globs.tests], ...mocha },
32+
33+
// Any custom settings to be applied
34+
{ files: [globs.ts],
35+
languageOptions: {
36+
parserOptions: { project: './tsconfig.json' },
37+
},
38+
rules: {
39+
// This repository is configured so that upon checkout, git should convert line endings to platform-specific
40+
// defaults and convert them back to LF when checking in. As such, we must enforce CRLF endings on Windows,
41+
// otherwise the lint task would fail on Windows systems.
42+
'linebreak-style': ['error', lbstyle],
43+
} },
44+
]
45+
46+
export default config

‎makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
SHELL := sh
33
export PATH := node_modules/.bin/:$(PATH)
44
export NODE_OPTIONS := --trace-deprecation
5+
export ESLINT_USE_FLAT_CONFIG := true
56

67
# On CI servers, use the `npm ci` installer to avoid introducing changes to the package-lock.json
78
# On developer machines, prefer the generally more flexible `npm install`. 💪
@@ -52,7 +53,7 @@ coverage: coverage/lcov.info
5253
install: node_modules $(GITFILES)
5354

5455
lint: force install
55-
eslint --cache --ext js,ts $(ESLINT_FLAGS) .
56+
eslint --cache --config eslint.config.mjs $(ESLINT_FLAGS) .
5657
remark --quiet .
5758

5859
test: force compile

0 commit comments

Comments
 (0)