Create the eslint-config-impress package to share eslint configuration with all impress projects.
72 lines
1.6 KiB
JavaScript
72 lines
1.6 KiB
JavaScript
const eslintTS = [
|
|
{
|
|
files: ['*.ts', '*.tsx'],
|
|
extends: [
|
|
'plugin:@typescript-eslint/recommended',
|
|
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
],
|
|
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
|
|
parserOptions: {
|
|
tsconfigRootDir: __dirname,
|
|
project: ['./tsconfig.json'],
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
'sort-imports': [
|
|
'error',
|
|
{
|
|
ignoreDeclarationSort: true,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ['*.d.ts'],
|
|
rules: {
|
|
'no-unused-vars': 'off',
|
|
},
|
|
},
|
|
];
|
|
|
|
const globalRules = {
|
|
'block-scoped-var': 'error',
|
|
curly: ['error', 'all'],
|
|
'import/no-duplicates': ['error', { considerQueryString: false }],
|
|
'import/order': [
|
|
'error',
|
|
{
|
|
alphabetize: {
|
|
order: 'asc',
|
|
},
|
|
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
pathGroups: [
|
|
{
|
|
pattern: '@/**',
|
|
group: 'internal',
|
|
},
|
|
],
|
|
pathGroupsExcludedImportTypes: ['builtin'],
|
|
'newlines-between': 'always',
|
|
warnOnUnassignedImports: true,
|
|
},
|
|
],
|
|
'no-alert': 'error',
|
|
'no-unused-vars': [
|
|
'error',
|
|
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
|
|
],
|
|
'react/jsx-curly-brace-presence': [
|
|
'error',
|
|
{ props: 'never', children: 'never', propElementValues: 'always' },
|
|
],
|
|
'sort-imports': [
|
|
'error',
|
|
{
|
|
ignoreDeclarationSort: true,
|
|
},
|
|
],
|
|
};
|
|
|
|
module.exports = { eslintTS, globalRules };
|