2022-01-11 17:07:27 +00:00
|
|
|
const rules = require('./tools/eslint-config/rules');
|
2021-05-13 11:42:10 +00:00
|
|
|
|
|
|
|
const baseTsRules = {
|
2022-01-11 17:07:27 +00:00
|
|
|
parserOptions: {
|
|
|
|
project: ['tsconfig.json'],
|
|
|
|
createDefaultProgram: true,
|
|
|
|
},
|
|
|
|
extends: [
|
|
|
|
'./tools/eslint-config/typescript',
|
|
|
|
'./tools/eslint-config/angular',
|
|
|
|
'./tools/eslint-config/lodash',
|
|
|
|
'prettier',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
...rules.createImportOrderRule({ internalPathsPattern: '@cc/**' }),
|
2022-05-24 12:01:51 +00:00
|
|
|
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
|
|
|
|
...rules.createAngularSelectorRules({ prefix: 'cc' }),
|
2022-01-11 17:07:27 +00:00
|
|
|
},
|
2021-05-13 11:42:10 +00:00
|
|
|
};
|
|
|
|
|
2022-05-24 12:01:51 +00:00
|
|
|
// TODO: pretenders for error
|
|
|
|
const lenientTsRules = {
|
|
|
|
'@typescript-eslint/no-unsafe-call': 'warn',
|
|
|
|
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
|
|
|
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
|
|
|
'@typescript-eslint/no-unsafe-return': 'warn',
|
|
|
|
'@typescript-eslint/no-misused-promises': 'warn',
|
|
|
|
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
|
|
};
|
|
|
|
|
2021-05-13 11:42:10 +00:00
|
|
|
module.exports = {
|
|
|
|
root: true,
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
overrides: [
|
|
|
|
{
|
2022-01-11 17:07:27 +00:00
|
|
|
...baseTsRules,
|
2021-05-13 11:42:10 +00:00
|
|
|
files: ['*.ts'],
|
|
|
|
rules: {
|
2022-01-11 17:07:27 +00:00
|
|
|
...baseTsRules.rules,
|
2022-05-24 12:01:51 +00:00
|
|
|
...lenientTsRules,
|
2021-05-13 11:42:10 +00:00
|
|
|
},
|
|
|
|
},
|
2022-05-24 12:01:51 +00:00
|
|
|
{
|
|
|
|
...baseTsRules,
|
|
|
|
// TODO: add fixed directories
|
|
|
|
files: ['**/src/app/core/**/*.ts'],
|
|
|
|
},
|
2021-05-13 11:42:10 +00:00
|
|
|
{
|
2022-01-11 17:07:27 +00:00
|
|
|
...baseTsRules,
|
2021-05-13 11:42:10 +00:00
|
|
|
files: ['*.spec.ts'],
|
2022-01-11 17:07:27 +00:00
|
|
|
extends: [...baseTsRules.extends, './tools/eslint-config/jasmine'],
|
2022-05-24 12:01:51 +00:00
|
|
|
rules: lenientTsRules,
|
2021-05-13 11:42:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['*.html'],
|
|
|
|
extends: ['plugin:@angular-eslint/template/recommended'],
|
|
|
|
rules: {
|
|
|
|
// TODO: pretenders for error
|
|
|
|
'@angular-eslint/template/no-negated-async': 'warn',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|