Skip to content

Commit

Permalink
(feat) flat config for eslint migrated from old config
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycoco committed Jun 18, 2024
1 parent db44cce commit ac25648
Show file tree
Hide file tree
Showing 11 changed files with 632 additions and 346 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

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

This file was deleted.

87 changes: 87 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
const eslint = require('@eslint/js');
const nodePlugin = require('eslint-plugin-n');
const eslintConfigPrettier = require('eslint-config-prettier');
const eslintPluginPrettier = require('eslint-plugin-prettier');
const tsEslint = require('typescript-eslint');
const typescriptParser = require('@typescript-eslint/parser');

module.exports = [
eslint.configs.recommended,
nodePlugin.configs['flat/recommended'],
eslintConfigPrettier,
{
plugins: {
n: nodePlugin,
prettier: eslintPluginPrettier,
},
rules: {
'prettier/prettier': 'error',
'block-scoped-var': 'error',
eqeqeq: 'error',
'no-var': 'error',
'prefer-const': 'error',
'eol-last': 'error',
'prefer-arrow-callback': 'error',
'no-trailing-spaces': 'error',
quotes: ['warn', 'single', {avoidEscape: true}],
'no-restricted-properties': [
'error',
{
object: 'describe',
property: 'only',
},
{
object: 'it',
property: 'only',
},
],
},
},
...tsEslint.configs.recommended.map(config => ({
...config,
files: ['**/*.ts', '**/*.tsx'],
})),
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
},
rules: {
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-warning-comments': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/camelcase': 'off',
'n/no-missing-import': 'off',
'n/no-empty-function': 'off',
'n/no-unsupported-features/es-syntax': 'off',
'n/no-missing-require': 'off',
'n/shebang': 'off',
'n/no-unpublished-import': [
'error',
{
convertPath: [
{
include: ['src/**'],
replace: ['^src/(.+)$', 'build/$1'],
},
],
},
],
'no-dupe-class-members': 'off',
'require-atomic-updates': 'off',
},
},
{
ignores: ['build/', 'test/fixtures/', 'template/'],
},
];
Loading

0 comments on commit ac25648

Please sign in to comment.