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

Can't override linterOptions in tslint.json #1463

Open

Description

@Pumpuli

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

Activity

  1. maksymilian-majer commented on Dec 10, 2018

    @maksymilian-majer

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions