Skip to content

Commit

Permalink
fix: linting (#2966)
Browse files Browse the repository at this point in the history
Eslint9 and stylistic mean we can ditch prettier, typscript specific rules, and a can revisit the whole eslint config.
  • Loading branch information
reconbot authored Dec 24, 2024
1 parent b7dca34 commit 867d8d2
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 302 deletions.
7 changes: 0 additions & 7 deletions .prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

70 changes: 15 additions & 55 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,68 +1,28 @@
import nodePlugin from 'eslint-plugin-n'
import mocha from 'eslint-plugin-mocha'
import globals from 'globals'
import js from '@eslint/js'
import eslintConfigPrettier from 'eslint-config-prettier'
import eslint from '@eslint/js'
import typescriptEslint from 'typescript-eslint'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import mocha from 'eslint-plugin-mocha'
import stylistic from '@stylistic/eslint-plugin'

/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: ['packages/*/node_modules', '**/docs', 'packages/*/dist/*'],
ignores: ['**/dist/', '**/*.js'],
},
js.configs.recommended,
nodePlugin.configs['flat/recommended-script'],
{ languageOptions: { globals: globals.node } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
mocha.configs['flat'].recommended,
...typescriptEslint.configs.recommended,
eslintConfigPrettier,
stylistic.configs['recommended-flat'],
{
languageOptions: {
globals: {
...globals.node,
...globals.mocha,
assert: false,
makeTestFeature: false,
shouldReject: false,
},
ecmaVersion: 12,
sourceType: 'commonjs',
},

rules: {
'no-extra-semi': 'off',
'@typescript-eslint/no-extra-semi': 'off',
'n/no-process-exit': 'off',
'no-var': 'error',

'n/no-extraneous-import': [
'error',
{
allowModules: ['sinon', 'chai'],
},
],

'n/no-missing-import': 'off',
'n/no-missing-require': 'off',
'n/no-unpublished-import': 'off',
'n/no-unpublished-require': 'off',
'n/no-unsupported-features/es-builtins': 'error',
'n/no-unsupported-features/es-syntax': 'off',
'n/no-unsupported-features/node-builtins': 'error',
'n/hashbang': 'off',
'object-shorthand': 'error',
'prefer-arrow-callback': 'error',
'prefer-const': 'error',
'prefer-template': 'error',
'mocha/no-exclusive-tests': 'error',
'mocha/no-hooks-for-single-case': 'off',
'mocha/no-mocha-arrows': 'off',
'mocha/no-pending-tests': 'error',
'mocha/no-setup-in-describe': 'off',
strict: ['error', 'never'],
'valid-jsdoc': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-require-imports': 'off',
'mocha/no-exclusive-tests': 'error',
'@stylistic/arrow-parens': ['error', 'as-needed'],
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
},
},
]
Loading

0 comments on commit 867d8d2

Please sign in to comment.