MOBILE-3320 lint: Separate app and tests linting

main
Noel De Martin 2020-10-14 17:24:02 +02:00
parent 43946fb61e
commit c062626e23
2 changed files with 270 additions and 256 deletions

View File

@ -1,19 +1,21 @@
module.exports = {
root: true,
overrides: [
{
files: ['*.ts'],
var appConfig = {
env: {
browser: true,
es6: true,
node: true,
},
plugins: [
'@typescript-eslint',
'header',
'jsdoc',
'prefer-arrow',
'promise',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
'plugin:jest/recommended',
'plugin:@angular-eslint/recommended',
'plugin:promise/recommended',
],
@ -22,14 +24,7 @@ module.exports = {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: [
'@typescript-eslint',
'header',
'jest',
'jsdoc',
'prefer-arrow',
'promise',
],
reportUnusedDisableDirectives: true,
rules: {
'@angular-eslint/component-class-suffix': ['error', { suffixes: ['Component', 'Page'] }],
'@typescript-eslint/adjacent-overload-signatures': 'error',
@ -256,7 +251,24 @@ module.exports = {
'use-isnan': 'error',
'yoda': 'error',
},
};
var testsConfig = Object.assign({}, appConfig);
testsConfig['rules']['padded-blocks'] = [
'error',
{
classes: 'always',
switches: 'never',
},
];
testsConfig['plugins'].push('jest');
testsConfig['extends'].push('plugin:jest/recommended');
module.exports = {
root: true,
overrides: [
Object.assign({ files: ['*.ts'] }, appConfig),
Object.assign({ files: ['*.test.ts'] }, testsConfig),
{
files: ['*.html'],
extends: ['plugin:@angular-eslint/template/recommended'],

View File

@ -16,6 +16,7 @@ import Faker from 'faker';
import { CoreError } from './error';
describe('CoreError', () => {
it('behaves like an error', () => {
// Arrange
const message = Faker.lorem.sentence();
@ -70,4 +71,5 @@ describe('CoreError', () => {
expect(error!.stack).not.toBeNull();
expect(error!.stack).toContain('src/app/classes/error.test.ts');
});
});