How can I remove parserOptions.project from an Angular MPA without running into "You have used a rule which requires parserServices to be generated"

Viewed 29

I'm migrating my angular project's TSLint to ESLing and just as predicted by VS Code's guide, keeping parserOptions.project attribute causes linting to take significant time and memory to run. Considering the project is massive and consists of MPAs, I'm attempting to remove the attribute so that ESLint can ignore semantic information and run faster.

However, when I attempt to remove it, I'm getting the following error:

Error while loading rule '@typescript-eslint/tslint/config': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.

I have tried to go the .eslintignore route, but I finding that I need to ignore my entire project, defeating the purpose of a linter.

How can I configure the parser to ignore semantic while avoiding the config error?

Please see my configuration file below.

module.exports = {
'env': {
    'browser': true,
    'es6': true,
    'node': true
},
'parser': '@typescript-eslint/parser',
'parserOptions': {
    'sourceType': 'module'
},
'plugins': [
    'eslint-plugin-import',
    '@angular-eslint/eslint-plugin',
    '@typescript-eslint',
    '@typescript-eslint/tslint'
],
'root': true,
'rules': {
    '@angular-eslint/component-class-suffix': 'error',
    '@angular-eslint/directive-class-suffix': 'error',
    '@angular-eslint/no-host-metadata-property': 'error',
    '@angular-eslint/no-input-rename': 'error',
    '@angular-eslint/no-inputs-metadata-property': 'error',
    '@angular-eslint/no-output-on-prefix': 'error',
    '@angular-eslint/no-output-rename': 'error',
    '@angular-eslint/no-outputs-metadata-property': 'error',
    '@angular-eslint/use-pipe-transform-interface': 'error',
    '@typescript-eslint/consistent-type-definitions': 'error',
    '@typescript-eslint/dot-notation': 'off',
    '@typescript-eslint/explicit-member-accessibility': [
        'off',
        {
            'accessibility': 'explicit'
        }
    ],
    '@typescript-eslint/indent': 'error',
    '@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': 'variable',
            'format': [
                'camelCase',
                'UPPER_CASE'
            ],
            'leadingUnderscore': 'forbid',
            'trailingUnderscore': 'forbid'
        }
    ],
    '@typescript-eslint/no-empty-function': 'off',
    '@typescript-eslint/no-empty-interface': 'error',
    '@typescript-eslint/no-inferrable-types': [
        'error',
        {
            'ignoreParameters': true
        }
    ],
    '@typescript-eslint/no-misused-new': 'error',
    '@typescript-eslint/no-non-null-assertion': 'error',
    '@typescript-eslint/no-shadow': [
        'error',
        {
            'hoist': 'all'
        }
    ],
    '@typescript-eslint/no-unused-expressions': 'error',
    '@typescript-eslint/prefer-function-type': 'error',
    '@typescript-eslint/quotes': [
        'error',
        'single'
    ],
    '@typescript-eslint/semi': [
        'error',
        'always'
    ],
    '@typescript-eslint/type-annotation-spacing': 'error',
    '@typescript-eslint/unified-signatures': 'error',
    'arrow-body-style': 'error',
    'brace-style': [
        'error',
        '1tbs'
    ],
    'constructor-super': 'error',
    'curly': 'error',
    'dot-notation': 'off',
    'eol-last': 'error',
    'eqeqeq': [
        'error',
        'smart'
    ],
    'guard-for-in': 'error',
    'id-denylist': 'off',
    'id-match': 'off',
    'import/no-deprecated': 'warn',
    'indent': 'off',
    'max-len': [
        'error',
        {
            'code': 140
        }
    ],
    'no-bitwise': 'error',
    'no-caller': 'error',
    'no-console': [
        'error',
        {
            'allow': [
                'warn',
                'dir',
                'timeLog',
                'assert',
                'clear',
                'count',
                'countReset',
                'group',
                'groupEnd',
                'table',
                'dirxml',
                'error',
                'groupCollapsed',
                'Console',
                'profile',
                'profileEnd',
                'timeStamp',
                'context'
            ]
        }
    ],
    'no-debugger': 'error',
    'no-empty': 'off',
    'no-empty-function': 'off',
    'no-eval': 'error',
    'no-fallthrough': 'error',
    'no-new-wrappers': 'error',
    'no-restricted-imports': [
        'error',
        'rxjs/Rx'
    ],
    'no-shadow': 'off',
    'no-throw-literal': 'error',
    'no-trailing-spaces': 'error',
    'no-undef-init': 'error',
    'no-underscore-dangle': 'off',
    'no-unused-expressions': 'off',
    'no-unused-labels': 'error',
    'no-var': 'error',
    'prefer-const': 'error',
    'quotes': 'off',
    'radix': 'error',
    'semi': 'off',
    'spaced-comment': [
        'error',
        'always',
        {
            'markers': [
                '/'
            ]
        }
    ],
    '@typescript-eslint/tslint/config': [
        'error',
        {
            'rules': {
                'import-spacing': true,
                'use-life-cycle-interface': true,
                'whitespace': [
                    true,
                    'check-branch',
                    'check-decl',
                    'check-operator',
                    'check-separator',
                    'check-type'
                ]
            }
        }
    ]
}

};

And here is the linting command I'm using to test: eslint -c .eslintrc.js --ext .ts ./projects (Note: the projects folder contains the individual SPAs)

Thanks in advance!

0 Answers
Related