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

#5728 Migrate eslint to flat config #5749

Closed
wants to merge 9 commits into from
168 changes: 0 additions & 168 deletions .eslintrc.js

This file was deleted.

173 changes: 173 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
// Importing necessary ESLint plugins
import typescriptEslint from 'typescript-eslint';
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
import headerPlugin from 'eslint-plugin-header';
import jsdocPlugin from 'eslint-plugin-jsdoc';
import preferArrowPlugin from 'eslint-plugin-prefer-arrow';
import importPlugin from 'eslint-plugin-import';
import noNullPlugin from 'eslint-plugin-no-null';
import localRulesPlugin from 'eslint-plugin-local-rules'; // Adjust the import path as necessary
import globals from 'globals';
import eslintConfigPrettier from 'eslint-config-prettier';
import pluginJs from '@eslint/js';
export default [
pluginJs.configs.recommended,
eslintConfigPrettier,
...typescriptEslint.config({
plugins: {
'@typescript-eslint': typescriptEslint.plugin,
'no-only-tests': noOnlyTestsPlugin,
header: headerPlugin,
jsdoc: jsdocPlugin,
'prefer-arrow': preferArrowPlugin,
import: importPlugin,
'no-null': noNullPlugin,
'local-rules': localRulesPlugin,
},
ignores: ['eslint.config.js'],
extends: [...typescriptEslint.configs.strictTypeChecked, ...typescriptEslint.configs.stylisticTypeChecked],
languageOptions: {
parser: typescriptEslint.parser,
sourceType: 'module',
Dismissed Show dismissed Hide dismissed
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.commonjs,
...globals.es6,
$: false,
chrome: false,
OpenPGP: false,
},
},
rules: {
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'explicit',
},
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/member-ordering': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: ['classProperty', 'objectLiteralProperty', 'typeProperty', 'classMethod', 'objectLiteralMethod', 'typeMethod', 'accessor', 'enumMember'],
format: null,
modifiers: ['requiresQuotes'],
},
{
selector: ['classProperty'],
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
{
selector: ['import'],
format: ['camelCase', 'PascalCase'],
},
],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': ['warn'],
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/type-annotation-spacing': 'off',
'@typescript-eslint/typedef': 'off',
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
'@typescript-eslint/unified-signatures': 'error',
complexity: 'off',
'constructor-super': 'error',
'dot-notation': 'error',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'error',
'header/header': ['error', 'block', ' ©️ 2016 - present FlowCrypt a.s. Limitations apply. Contact [email protected] '],
'id-denylist': 'error',
'id-match': 'error',
'import/order': 'off',
'jsdoc/check-alignment': 'off',
'jsdoc/check-indentation': 'off',
'jsdoc/newline-after-description': 'off',
'max-classes-per-file': 'off',
'no-bitwise': 'off',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': 'off',
'no-constant-condition': 0,
'no-control-regex': 0,
'no-debugger': 'error',
'no-empty': 'error',
'no-empty-pattern': 0,
'no-eval': 'error',
'no-fallthrough': 0,
'no-invalid-this': 'off',
'no-new-wrappers': 'error',
'no-null/no-null': 'error',
'no-only-tests/no-only-tests': ['error'],
'no-prototype-builtins': 0,
'no-shadow': 'off',
'no-throw-literal': 'error',
'no-undef': 0,
'no-undef-init': 'error',
'no-underscore-dangle': 'error',
'no-unsafe-finally': 'error',
'no-unused-expressions': 'off',
'no-unused-labels': 'error',
'no-use-before-define': 'off',
'no-useless-escape': 0,
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['off', 'never'],
'prefer-arrow/prefer-arrow-functions': 'error',
'prefer-const': [
'error',
{
destructuring: 'all',
},
],
radix: 'off',
'require-atomic-updates': 0,
'sort-imports': 'off',
'spaced-comment': [
'error',
'always',
{
markers: ['/'],
},
],
'local-rules/standard-loops': 'error',
},
}),
];
Loading
Loading