Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Upgrade to ESLint v9 #65

Merged
merged 10 commits into from
Oct 18, 2024
4 changes: 0 additions & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,5 @@
"matchBaseBranches": ["eslint-v9"],
"labels": ["dependencies", "v9"]
}
],
"baseBranches": [
"master",
"eslint-v9"
]
}
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
# @dtrw/eslint-config

<!-- support table - import no support for eslint@9 - https://github.com/import-js/eslint-plugin-import/issues/2948 -->

![npm version](https://img.shields.io/npm/v/@dtrw/eslint-config/latest)
![npm next version](https://img.shields.io/npm/v/@dtrw/eslint-config/next)
![NPM License](https://img.shields.io/npm/l/@dtrw/eslint-config)
![Release](https://img.shields.io/github/actions/workflow/status/burtek/eslint-config/release.yml?label=publish%20release)
![dependencies](https://img.shields.io/librariesio/release/npm/@dtrw/eslint-config)


This is repository with my `eslint` configs for multiple purposes that are used (or will be used) in my other projects.

## Install

```bash
yarn add -D @dtrw/eslint-config eslint@^8.56
yarn add -D @dtrw/eslint-config eslint
```

or

```bash
npm i -D @dtrw/eslint-config eslint@^8.56
npm i -D @dtrw/eslint-config eslint
```

## Usage

This config requires `eslint` `^8.56` (not compatible with `eslint@9` yet - see [#65](https://github.com/burtek/eslint-config/pull/65))


```js
// eslint.config.js

Expand Down
54 changes: 3 additions & 51 deletions configs/base.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import js from '@eslint/js';
import stylisticPlugin from '@stylistic/eslint-plugin';
import importPlugin from 'eslint-plugin-import-x';
import promise from 'eslint-plugin-promise';
Expand Down Expand Up @@ -35,71 +36,44 @@ export function prepareConfig() {
promise
},
rules: {
...js.configs.recommended.rules,
'accessor-pairs': 'error',
'array-callback-return': 'error',
'arrow-body-style': 'error',
'block-spacing': 'error',
'brace-style': 'error',
'camelcase': 'error',
'consistent-return': 'error',
'constructor-super': 'error',
'curly': 'error',
'default-case': 'error',
'default-case-last': 'error',
'dot-notation': 'error',
'eqeqeq': 'error',
'for-direction': 'error',
'func-names': 'error',
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
'getter-return': 'error',
'grouped-accessor-pairs': 'error',
'guard-for-in': 'error',
'new-cap': 'error',
'no-alert': 'error',
'no-array-constructor': 'error',
'no-async-promise-executor': 'error',
'no-await-in-loop': 'error',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-class-assign': 'error',
'no-compare-neg-zero': 'error',
'no-cond-assign': ['error', 'always'],
'no-console': 'error',
'no-const-assign': 'error',
'no-constant-binary-expression': 'error',
'no-constant-condition': 'error',
'no-constructor-return': 'error',
'no-continue': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-div-regex': 'error',
'no-dupe-args': 'error',
'no-dupe-class-members': 'error',
'no-dupe-else-if': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-else-return': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-empty-character-class': 'error',
'no-empty-function': 'error',
'no-empty-pattern': 'error',
'no-empty-static-block': 'error',
'no-eval': 'error',
'no-ex-assign': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': ['error', { allowEmptyCase: true }],
'no-func-assign': 'error',
'no-global-assign': 'error',
'no-implicit-coercion': ['error', { allow: ['!!'] }],
'no-implied-eval': 'error',
'no-import-assign': 'error',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-invalid-this': 'error',
'no-irregular-whitespace': 'error',
'no-iterator': 'error',
'no-labels': 'error',
'no-lone-blocks': 'error',
Expand All @@ -115,46 +89,28 @@ export function prepareConfig() {
ignoreDefaultValues: true
}
],
'no-misleading-character-class': 'error',
'no-multi-assign': 'error',
'no-multi-str': 'error',
'no-negated-condition': 'error',
'no-nested-ternary': 'warn',
'no-new': 'error',
'no-new-func': 'error',
'no-new-native-nonconstructor': 'error',
'no-new-wrappers': 'error',
'no-nonoctal-decimal-escape': 'error',
'no-obj-calls': 'error',
'no-object-constructor': 'error',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-param-reassign': 'error',
'no-promise-executor-return': 'error',
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-setter-return': 'error',
'no-shadow': 'error',
'no-shadow-restricted-names': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'warn',
'no-this-before-super': 'error',
'no-throw-literal': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-unexpected-multiline': 'error',
'no-unmodified-loop-condition': 'error',
'no-unreachable': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unused-expressions': 'error',
'no-unused-labels': 'error',
'no-unused-vars': [
'error',
{
Expand All @@ -165,17 +121,14 @@ export function prepareConfig() {
],
'no-use-before-define': ['error', { classes: true, functions: false, variables: true }],
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-constructor': 'error',
'no-useless-escape': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-void': ['error', { allowAsStatement: true }],
'no-warning-comments': 'error',
'no-with': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'operator-assignment': 'error',
Expand All @@ -193,9 +146,7 @@ export function prepareConfig() {
'radix': 'error',
'require-atomic-updates': 'error',
'require-await': 'error',
'require-yield': 'error',
'symbol-description': 'error',
'use-isnan': 'error',
'valid-typeof': ['error', { requireStringLiterals: true }],
'yoda': ['error', 'never', { exceptRange: true }],

Expand Down Expand Up @@ -354,6 +305,7 @@ export function prepareConfig() {
'no-magic-numbers': 'off',
'no-shadow': 'off',
'no-throw-literal': 'off', // extended by tseslint/only-throw-error
'no-unsafe-optional-chaining': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@next/eslint-plugin-next": "14.2.15",
"@stylistic/eslint-plugin": "2.9.0",
"eslint-import-resolver-typescript": "3.6.3",
"eslint-plugin-cypress": "3.6.0",
"eslint-plugin-cypress": "4.0.0",
"eslint-plugin-import-x": "4.3.1",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-jest-dom": "5.4.0",
Expand All @@ -33,12 +33,12 @@
"typescript-eslint": "8.10.0"
},
"devDependencies": {
"@types/eslint": "^8.56.8",
"@types/eslint": "^9.6.1",
"@types/eslint__js": "^8.42.3",
"@types/jest": "^29.5.12",
"@types/node": "^20.0.0",
"commit-and-tag-version": "^12.2.0",
"eslint": "^8.57.0",
"eslint-plugin-mdx": "^3.1.5",
"eslint": "~9.12.0",
"exit-code": "^1.0.2",
"jest": "^29.7.0",
"rimraf": "^6.0.0",
Expand All @@ -47,7 +47,7 @@
"typescript": "~5.6.0"
},
"peerDependencies": {
"eslint": "^8.56",
"eslint": "^9.4.0",
"typescript": ">=4.7.4"
},
"private": false,
Expand Down
Loading
Loading