Skip to content

Commit

Permalink
chore(eslint): convert config to TypeScript (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusrbrown authored Sep 9, 2024
1 parent a8c7c55 commit 07d934e
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 48 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"cSpell.words": ["actioneers", "automerge", "bfra", "conventionalcommits", "Parens", "yarnpkg"],

"eslint.options": {
"flags": ["unstable_ts_config"]
},

"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
20 changes: 10 additions & 10 deletions eslint.config.mjs → eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
// @ts-check
import eslint from '@eslint/js'
import {defineFlatConfig} from 'eslint-define-config'
import type {Linter} from 'eslint'
import globals from 'globals'
import tseslint from 'typescript-eslint'

/// <reference types="@eslint-types/import" />
/// <reference types="@eslint-types/typescript-eslint" />

// @ts-expect-error - TODO: Need to cast to the return type of `tseslint.config`
export default defineFlatConfig([
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
ignores: ['**/__tests__', '**/dist', '**/lib', '**/node_modules'],
},
...tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommendedTypeChecked),

{
languageOptions: {
ecmaVersion: 2022,
globals: {
...globals.es2021,
...globals.node,
},

ecmaVersion: 2018,
sourceType: 'module',

parserOptions: {
ecmaVersion: 2022,
projectService: true,
tsconfigRootDir: import.meta.dirname,
sourceType: 'module',
},
sourceType: 'module',
},

rules: {
Expand Down Expand Up @@ -86,4 +86,4 @@ export default defineFlatConfig([
'@typescript-eslint/unbound-method': 'error',
},
},
])
) as Linter.Config
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"check-types": "tsc",
"fix": "pnpm run format && pnpm run lint --fix",
"format": "prettier --write .",
"lint": "eslint .",
"lint": "eslint --flag unstable_ts_config .",
"test": "vitest"
},
"prettier": "@bfra.me/prettier-config/120-proof",
Expand All @@ -36,16 +36,15 @@
"@bfra.me/tsconfig": "0.6.0",
"@eslint-types/import": "2.29.1",
"@eslint-types/typescript-eslint": "7.5.0",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.10.0",
"@semantic-release/git": "10.0.1",
"@types/eslint__js": "8.42.3",
"@types/node": "20.16.0",
"@vercel/ncc": "0.38.1",
"conventional-changelog-conventionalcommits": "8.0.0",
"eslint": "9.10.0",
"eslint-define-config": "2.1.0",
"globals": "15.9.0",
"jiti": "1.21.6",
"js-yaml": "4.1.0",
"prettier": "3.3.3",
"semantic-release": "24.1.0",
Expand Down
67 changes: 33 additions & 34 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"extends": "@bfra.me/tsconfig",
"compilerOptions": {
"composite": false,
"declaration": false,
"module": "ESNext",
"moduleResolution": "Bundler",
"noEmit": true,
"target": "ESNext"
},
"exclude": ["dist", "node_modules", "**/*.test.ts"],
"include": ["src", "eslint.config.*"]
"include": ["src", "eslint.config.ts"]
}

0 comments on commit 07d934e

Please sign in to comment.