Skip to content

Commit

Permalink
Update to eslint v9 flat config
Browse files Browse the repository at this point in the history
BREAKING CHANGE: minimum supported version of eslint is v9
  • Loading branch information
bcvazquez committed Jan 3, 2025
1 parent d33609d commit 77c28c0
Show file tree
Hide file tree
Showing 6 changed files with 498 additions and 501 deletions.
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import planetConfig from './react.js';

export default [...planetConfig];
213 changes: 131 additions & 82 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,133 @@
module.exports = {
plugins: ['import', 'sort-imports-es6-autofix', 'prettier'],
env: {
node: true,
browser: true,
es6: true,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
'array-callback-return': 'error',
'block-scoped-var': 'error',
curly: 'error',
'default-case': 'error',
'dot-notation': ['error', {allowPattern: '^[a-z]+(_[a-z]+)+$'}],
eqeqeq: 'error',
'import/default': 'error',
'import/extensions': ['error', 'always', {ignorePackages: true}],
'import/first': 'error',
'import/named': 'error',
'import/no-duplicates': 'error',
'import/no-self-import': 'error',
'import/no-unresolved': ['error', {commonjs: true}],
'no-case-declarations': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-const-assign': 'error',
'no-constant-binary-expression': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'error',
'no-empty-character-class': 'error',
'no-eq-null': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-inner-declarations': ['error', 'functions'],
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-negated-in-lhs': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'no-param-reassign': 'error',
'no-process-exit': 'off',
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-sparse-arrays': 'error',
'no-undef': 'error',
'no-underscore-dangle': 'off',
'no-unexpected-multiline': 'error',
'no-unreachable': 'error',
'no-unsafe-finally': 'error',
'no-unused-vars': ['error', {ignoreRestSiblings: true}],
'no-use-before-define': ['error', 'nofunc'],
'no-var': 'error',
'prefer-const': 'error',
'prettier/prettier': [
'error',
{
singleQuote: true,
bracketSpacing: false,
arrowParens: 'avoid',
},
],
strict: 'off',
'sort-imports-es6-autofix/sort-imports-es6': [
'error',
{
ignoreCase: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'],
import globals from 'globals';
import importPlugin from 'eslint-plugin-import';
import js from '@eslint/js';
import prettier from 'eslint-plugin-prettier';
import sortImportPlugin from 'eslint-plugin-sort-imports-es6-autofix';

export default [
js.configs.recommended,
importPlugin.flatConfigs.recommended,
{
name: 'planet/recommnded',
plugins: {
prettier,
'sort-imports-es6-autofix': sortImportPlugin,
},

languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
],
'use-isnan': 'error',
'valid-typeof': 'error',

ecmaVersion: 'latest',
sourceType: 'module',
},

rules: {
'array-callback-return': 'error',
'block-scoped-var': 'error',
curly: 'error',
'default-case': 'error',

'dot-notation': [
'error',
{
allowPattern: '^[a-z]+(_[a-z]+)+$',
},
],

eqeqeq: 'error',
'import/default': 'error',

'import/extensions': [
'error',
'always',
{
ignorePackages: true,
},
],

'import/first': 'error',
'import/named': 'error',
'import/no-duplicates': 'error',
'import/no-self-import': 'error',

'import/no-unresolved': [
'error',
{
commonjs: true,
},
],

'no-case-declarations': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-const-assign': 'error',
'no-constant-binary-expression': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'error',
'no-empty-character-class': 'error',
'no-eq-null': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-inner-declarations': ['error', 'functions'],
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-negated-in-lhs': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'no-param-reassign': 'error',
'no-process-exit': 'off',
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-sparse-arrays': 'error',
'no-undef': 'error',
'no-underscore-dangle': 'off',
'no-unexpected-multiline': 'error',
'no-unreachable': 'error',
'no-unsafe-finally': 'error',

'no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],

'no-use-before-define': ['error', 'nofunc'],
'no-var': 'error',
'prefer-const': 'error',

'prettier/prettier': [
'error',
{
singleQuote: true,
bracketSpacing: false,
arrowParens: 'avoid',
},
],

strict: 'off',

'sort-imports-es6-autofix/sort-imports-es6': [
'error',
{
ignoreCase: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'],
},
],

'use-isnan': 'error',
'valid-typeof': 'error',
},
},
};
];
Loading

0 comments on commit 77c28c0

Please sign in to comment.