@nexusui/eslint-config
Version:
nexus eslint config
65 lines (62 loc) • 2.63 kB
JavaScript
module.exports = {
env: {
browser: true,
node: true,
es2021: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic',
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json'],
},
rules: {
// TypeScript specific rules
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/consistent-type-exports': ['error', { fixMixedExportsWithInlineTypeSpecifier: true }],
// Disallow console.log, allow console.warn/error
'no-console': ['warn', { allow: ['warn', 'error'] }],
// Disallow the unary operators ++ and --, allow for loop after thoughts
'no-plusplus': ['warn', { allowForLoopAfterthoughts: true }],
// Disallow reassigning function parameters
'no-param-reassign': 'off', // It's fine in some case.
// Disallow else blocks after return statements in if statements
'no-else-return': 'off', // It's fine to use else blocks
// Disallow nested ternary expressions
'no-nested-ternary': 'off', // It's fine to help simplify writing
// Enforce consistent spacing after the // or /* in a comment
'spaced-comment': 'off', // It's annoying
// Require or disallow named function expressions
'func-names': 'off', // It's fine to use named function expressions
// Require destructuring from arrays and/or objects
'prefer-destructuring': 'off', // stylistic choice, destructuring harm grep potential
// Require return statements to either always or never specify values
'consistent-return': 'off', // Need allow functions to have different return behavior depending on code branching
// Require or disallow assignment operator shorthand where possible
'operator-assignment': 'off', // stylistic choice
// deprecated
'global-require': 'off',
// Import rules
'import/prefer-default-export': 'off',
'import/no-unresolved': 'off', // TypeScript handles this
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
};