Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Can't override linterOptions in tslint.json #1463

Open
Pumpuli opened this issue Aug 16, 2018 · 1 comment
Open

Can't override linterOptions in tslint.json #1463

Pumpuli opened this issue Aug 16, 2018 · 1 comment

Comments

@Pumpuli
Copy link

Pumpuli commented Aug 16, 2018

Short description of the problem:

Adding linterOptions to tslint.json has no effect.

What behavior are you expecting?

Adding linterOptions to tslint.json should work, e.g. exclude some project files from linting.

Steps to reproduce:

  1. Create a new project
  2. Add some linter options to tslint.json (example below)
  3. Edit home page code and introduce a linting error
  4. Run ionic-app-scripts lint
{
    "linterOptions": {
        "exclude": ["src/pages/**/*"]
    },
    ...
}

Which @ionic/app-scripts version are you using?

3.1.0

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

export function getTsLintConfig(tsLintConfig: string, linterOptions?: LinterOptions): LinterConfig {
const config = Configuration.loadConfigurationFromPath(tsLintConfig);
Object.assign(config, isObject(linterOptions) ? {linterOptions} : {});
return config;
}

The above function should be something like this:

const mergedLinterOptions = Object.assign({}, config.linterOptions, linterOptions);
Object.assign(config, { linterOptions: mergedLinterOptions });

Possibly related PR: #1204

@maksymilian-majer
Copy link

What you mention is not the only problem. It's also that tslint in version 5.11.0 doesn't properly use linterOptions when linting on file by file basis. The master branch on tslint has this fixed, but there hasn't been any releases for 5 months.

Right now I have worked around this in my fork of ionic-app-scripts:
npm i https://github.com/maksymilian-majer/ionic-app-scripts\#linter-dist

I have also prepared a PR based on your suggestion, but I will submit it once tslint has been updated, cause now it won't do any good.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants