Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint script in package.json is ignored #3317

Closed
rodrijuarez opened this issue Nov 30, 2016 · 6 comments · Fixed by #4261
Closed

Lint script in package.json is ignored #3317

rodrijuarez opened this issue Nov 30, 2016 · 6 comments · Fixed by #4261
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix

Comments

@rodrijuarez
Copy link

rodrijuarez commented Nov 30, 2016

OS?

OSX Sierra

Versions.

Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.16
node: 6.8.1
os: darwin x64

Repro steps.

I've tried to change the way tslint runs when we run the command ng test in the scripts section of the file package.json but it seems to be ignored no matter what I change. At least that's what I understood here

Mention any other details that might be useful.

When I run npm run lint or ng lint (the same goes when I run tslint) it works as expected using the overriden config of the package.json, but when I run ng test, maybe it takes another configuration
This is the scripts section in the package.json:

  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\" -e \"src/**/assets/**\"",
    "tslint": "tslint \"src/**/*.ts\" -e \"src/**/assets/**\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  }

This is the angular-cli.json:

{
  "project": {
    "version": "1.0.0-beta.16",
    "name": "node-ui"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": "assets",
      "index": "index.html",
      "main": "main.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "prefix": "app",
      "mobile": false,
      "styles": [
        "styles.scss"
      ],
      "scripts": [],
      "environments": {
        "source": "environments/environment.ts",
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "addons": [],
  "packages": [],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "prefixInterfaces": false
  }
}
@clydin
Copy link
Member

clydin commented Nov 30, 2016

The current implementation is somewhat awkward in that ng lint uses npm run but ng test uses the webpack tslint-loader. So linting via test has a fixed configuration.

@rodrijuarez
Copy link
Author

@clydin So there is no way at this moment to ignore or exclude files from tslint? Or configure anything?

@clydin
Copy link
Member

clydin commented Nov 30, 2016

With ng lint yes. I believe ng test doesn't lint by default anyway.

@rodrijuarez
Copy link
Author

Yes, but I want to configure tslint when I run ng test. I don't want to have two different configurations, I want ng test and ng lint to use the same config

@filipesilva
Copy link
Contributor

You can run linting while testing with ng test --lint but as @clydin mentioned that seem to be using the wrong lint config. That's a bug.

@filipesilva filipesilva added command: test P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix labels Dec 30, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants