Skip to content

Commit

Permalink
style: update to eslint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandopasik committed Oct 2, 2024
1 parent 6c4cf7e commit ababcc0
Show file tree
Hide file tree
Showing 7 changed files with 448 additions and 412 deletions.
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

39 changes: 0 additions & 39 deletions .eslintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*": ["prettier --check"],
"*.{js,ts}": ["eslint", "jest --bail --findRelatedTests --passWithNoTests"]
"*": ["prettier --check", "eslint"],
"*.{js,ts}": ["jest --bail --findRelatedTests --passWithNoTests"]
}
61 changes: 61 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import eslint from '@eslint/js';
import prettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import lit from 'eslint-plugin-lit';
import wc from 'eslint-plugin-wc';
import ymlPlugin from 'eslint-plugin-yml';
import globals from 'globals';
import ts from 'typescript-eslint';

export default ts.config(
{
ignores: ['coverage/', 'docs/', 'demo/dist/', 'lib/', 'lit-redux-router.*'],
},
eslint.configs.all,
importPlugin.flatConfigs.recommended,
importPlugin.configs.typescript,
lit.configs['flat/recommended'],
wc.configs['flat/recommended'],
...ymlPlugin.configs['flat/recommended'],
...ymlPlugin.configs['flat/prettier'],
{
files: ['**/*.js', '**/*.ts'],
languageOptions: {
ecmaVersion: 'latest',
globals: { ...globals.node },
parserOptions: { project: 'tsconfig.json' },
sourceType: 'module',
},
rules: {
'import/no-unresolved': 'off',
'max-lines': ['error', { max: 133, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': ['error', { max: 30, skipBlankLines: true, skipComments: true }],
'max-statements': ['error', { max: 35 }],
'no-ternary': 'off',
'one-var': 'off',
'sort-imports': 'off',
},
settings: { 'import/resolver': { typescript: {} } },
},
{
// eslint-disable-next-line import/no-named-as-default-member
extends: [...ts.configs.all],
files: ['**/*.ts'],
rules: {
'@typescript-eslint/class-methods-use-this': 'off',
// eslint-disable-next-line no-magic-numbers
'@typescript-eslint/no-magic-numbers': ['error', { ignore: [0, 1, 2] }],
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
},
},
{
files: ['**/*.test.*'],
rules: {
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'max-lines': 'off',
'max-lines-per-function': 'off',
},
},
prettier,
);
2 changes: 0 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */

export default {
collectCoverageFrom: ['src/**/*.{j,t}s'],
moduleNameMapper: { '^(\\.{1,2}/.*)\\.js$': '$1' },
Expand Down
Loading

0 comments on commit ababcc0

Please sign in to comment.