Skip to content

Commit

Permalink
Upgrade ESLint, rework config, split out Prettier (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss authored Feb 24, 2025
1 parent 49aae1e commit d03dbfa
Show file tree
Hide file tree
Showing 6 changed files with 2,992 additions and 2,109 deletions.
41 changes: 0 additions & 41 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:

- run: npm install-ci-test

- run: npm run eslint
- run: npm run lint
72 changes: 72 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'

import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import _import from 'eslint-plugin-import'
import n from 'eslint-plugin-n'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
import globals from 'globals'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended'
)
),
{
plugins: {
import: fixupPluginRules(_import),
'simple-import-sort': simpleImportSort,
n,
'@typescript-eslint': fixupPluginRules(typescriptEslint),
},

languageOptions: {
globals: {
...globals.node,
},

parser: tsParser,
ecmaVersion: 5,
sourceType: 'commonjs',
},

rules: {
'import/no-cycle': 'error',
'n/no-extraneous-import': 'error',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
{
files: ['test/**'],

rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
]
Loading

0 comments on commit d03dbfa

Please sign in to comment.