Skip to content

Commit

Permalink
feat: upgrade deps, move to ESLint flat config 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrossmann committed Feb 16, 2024
1 parent 5c3bfe0 commit b6560e6
Show file tree
Hide file tree
Showing 7 changed files with 8,525 additions and 6,086 deletions.
70 changes: 0 additions & 70 deletions .eslintrc.js

This file was deleted.

6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"files.trimTrailingWhitespace": true,
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"eslint.lintTask.options": "--cache --ext js,ts .",
"eslint.lintTask.options": "--cache --config eslint.config.mjs .",
"eslint.experimental.useFlatConfig": true,
"eslint.options": {
"overrideConfigFile": "eslint.config.mjs",
},
"mochaExplorer.files": "{src,test}/**/*.test.js"
}
46 changes: 46 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import * as os from 'os'

Check failure on line 1 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 1 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'
import nodev20 from '@strv/eslint-config-node/v20'

Check failure on line 2 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 2 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'
import nodeopt from '@strv/eslint-config-node/optional'

Check failure on line 3 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 3 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'
import nodestyle from '@strv/eslint-config-node/style'

Check failure on line 4 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 4 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'
import ts from '@strv/eslint-config-typescript'

Check failure on line 5 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 5 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'
import tsoptional from '@strv/eslint-config-typescript/optional'

Check failure on line 6 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 6 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'
import tsstyle from '@strv/eslint-config-typescript/style'

Check failure on line 7 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 7 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'
import mocha from '@strv/eslint-config-mocha'

Check failure on line 8 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 8 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 9 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 9 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'
const lbstyle = os.platform() === 'win32' ? 'windows' : 'unix'

Check failure on line 10 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 18)

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 10 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / verify (windows-2022, 20)

Expected linebreaks to be 'LF' but found 'CRLF'
const globs = {
mjs: '**/*.mjs',
ts: '**/*.ts',
tests: '**/*.test.ts',
}

/** @type {Array<import("eslint").Linter.FlatConfig>} */
const config = [
{ linterOptions: {
reportUnusedDisableDirectives: true,
} },
{ ignores: ['**/*.js', '**/*.d.ts', 'node_modules'] },
{ files: [globs.ts, globs.mjs], ...nodev20 },
{ files: [globs.ts, globs.mjs], ...nodeopt },
{ files: [globs.ts, globs.mjs], ...nodestyle },

{ files: [globs.ts], ...ts },
{ files: [globs.ts], ...tsoptional },
{ files: [globs.ts], ...tsstyle },

{ files: [globs.tests], ...mocha },

// Any custom settings to be applied
{ files: [globs.ts],
languageOptions: {
parserOptions: { project: './tsconfig.json' },
},
rules: {
// This repository is configured so that upon checkout, git should convert line endings to platform-specific
// defaults and convert them back to LF when checking in. As such, we must enforce CRLF endings on Windows,
// otherwise the lint task would fail on Windows systems.
'linebreak-style': ['error', lbstyle],
} },
]

export default config
3 changes: 2 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
SHELL := sh
export PATH := node_modules/.bin/:$(PATH)
export NODE_OPTIONS := --trace-deprecation
export ESLINT_USE_FLAT_CONFIG := true

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

lint: force install
eslint --cache --ext js,ts $(ESLINT_FLAGS) .
eslint --cache --config eslint.config.mjs $(ESLINT_FLAGS) .
remark --quiet .

test: force compile
Expand Down
Loading

0 comments on commit b6560e6

Please sign in to comment.