Vmeda.Online/.eslintrc.js

286 lines
8.3 KiB
JavaScript
Raw Normal View History

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:@angular-eslint/recommended',
'plugin:promise/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
reportUnusedDisableDirectives: true,
rules: {
'@angular-eslint/component-class-suffix': ['error', { suffixes: ['Component', 'Page'] }],
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/ban-types': [
'error',
{
types: {
Boolean: {
message: 'Use \'boolean\' instead.',
},
Number: {
message: 'Use \'number\' instead.',
2020-10-07 12:54:40 +00:00
},
String: {
message: 'Use \'string\' instead.',
},
Object: {
message: 'Use {} instead.',
},
},
},
],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public',
},
],
'@typescript-eslint/explicit-module-boundary-types': [
'error',
{
allowArgumentsExplicitlyTypedAsAny: true,
},
],
'@typescript-eslint/indent': [
'error',
4,
{
SwitchCase: 1,
ignoredNodes: [
'ClassProperty *',
],
},
],
'@typescript-eslint/lines-between-class-members': [
'error',
'always',
{
exceptAfterSingleLine: true,
},
],
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/member-ordering': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'property',
modifiers: ['readonly'],
format: ['UPPER_CASE'],
},
{
selector: 'property',
format: ['camelCase'],
},
],
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-inferrable-types': [
'error',
{
ignoreParameters: true,
},
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/quotes': [
'error',
'single',
],
'@typescript-eslint/semi': [
'error',
'always',
],
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unified-signatures': 'error',
'header/header': [
2,
'line',
[
' (C) Copyright 2015 Moodle Pty Ltd.',
'',
' Licensed under the Apache License, Version 2.0 (the "License");',
' you may not use this file except in compliance with the License.',
' You may obtain a copy of the License at',
'',
' http://www.apache.org/licenses/LICENSE-2.0',
'',
' Unless required by applicable law or agreed to in writing, software',
' distributed under the License is distributed on an "AS IS" BASIS,',
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
' See the License for the specific language governing permissions and',
' limitations under the License.',
],
1,
],
'promise/catch-or-return': [
'warn',
{
allowFinally: true,
terminationMethod: ['catch', 'finally'],
},
],
'arrow-body-style': ['error', 'as-needed'],
'array-bracket-spacing': ['error', 'never'],
'comma-dangle': ['error', 'always-multiline'],
'constructor-super': 'error',
'curly': 'error',
'eol-last': 'error',
'function-call-argument-newline': ['error', 'consistent'],
'function-paren-newline': ['error', 'multiline-arguments'],
'id-blacklist': [
'error',
'any',
'Number',
'number',
'String',
'string',
'Boolean',
'boolean',
'Undefined',
'undefined',
],
'id-match': 'error',
'jsdoc/check-alignment': 'error',
'jsdoc/check-indentation': [
'error',
{
excludeTags: ['param'],
},
],
'jsdoc/newline-after-description': 'error',
'linebreak-style': [
'error',
'unix',
],
'max-len': [
'error',
{
code: 132,
},
],
'new-parens': 'error',
'no-bitwise': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-empty': 'error',
'no-eval': 'error',
'no-invalid-this': 'error',
'no-irregular-whitespace': 'error',
'no-multiple-empty-lines': 'error',
'no-new-wrappers': 'error',
'no-redeclare': 'error',
'no-sequences': 'error',
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'error',
'no-unused-labels': 'error',
'no-var': 'error',
'object-curly-spacing': ['error', 'always'],
'one-var': ['error', 'never'],
'padded-blocks': [
'error',
{
classes: 'always',
blocks: 'never',
switches: 'never',
},
],
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: '*',
next: 'return',
},
],
'prefer-arrow/prefer-arrow-functions': [
'error',
{
singleReturnOnly: true,
allowStandaloneDeclarations: true,
},
],
'prefer-const': 'error',
'prefer-spread': 'off',
'quote-props': [
'error',
'consistent-as-needed',
],
'spaced-comment': [
'error',
'always',
{
markers: [
'/',
],
},
],
'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'],
rules: {
'max-len': ['error', { code: 140 }],
},
},
{
files: ['*.component.ts'],
extends: ['plugin:@angular-eslint/template/process-inline-templates'],
},
],
};