Vue-cli: TSLint: node_modules/** should be excluded by default

Created on 29 Apr 2018  路  1Comment  路  Source: vuejs/vue-cli

Version

3.0.0-beta.6

Reproduction link

https://github.com/jubairsaidi/vue_exclusion_bug

Steps to reproduce

Create a new project, and then install vue-awesome npm i vue-awesome

then in your main.ts file:

import 'vue-awesome/icons';
import Icon from 'vue-awesome/components/Icon.vue';
Vue.component('icon', Icon);

then run npm run serve

What is expected?

 DONE  Compiled successfully in 13427ms                                                                                                                                                            12:54:51 PM

No type errors found
No lint errors found
Version: typescript 2.8.3, tslint 5.9.1
Time: 7455ms

What is actually happening?

WARNING in /path/to/project/node_modules/vue-awesome/components/Icon.vue
224:41 Missing semicolon
    222 | let cursor = 0xd4937
    223 | function getId () {
  > 224 |   return `fa-${(cursor  ).toString(16)}`
        |                                         ^
    225 | }
    226 | </script>
    227 |
No type errors found
Version: typescript 2.8.3, tslint 5.9.1
Time: 6093ms

To solve this, this is what my tslint.json looks like

{
  "defaultSeverity": "warning",
  "extends": [
    "tslint:recommended"
  ],
  "linterOptions": {
      "exclude": [
          "node_modules/**"
      ]
  },
  "rules": {
    "quotemark": [true, "single"],
    "indent": [true, "spaces", 2],
    "interface-name": false,
    "ordered-imports": false,
    "object-literal-sort-keys": false,
    "no-consecutive-blank-lines": false,
    "trailing-comma": [false],
    "no-console": [false, "warn", "error"],
    "arrow-parens": [false, "as-needed"],
    "curly": [false, "as-needed"]
  }
}

As you can see, I have to explicitly add node_modules/** to the exclude list. Correct me if I'm wrong but this should not be the case, i.e. built in.

enhancement typescript

Most helpful comment

Looks like eslint ignores node_modules/** by default but tslint does not. Should be an easy fix to update the tslint plugin to match the eslint behavior

>All comments

Looks like eslint ignores node_modules/** by default but tslint does not. Should be an easy fix to update the tslint plugin to match the eslint behavior

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dimavolo picture dimavolo  路  75Comments

italomaia picture italomaia  路  88Comments

yyx990803 picture yyx990803  路  80Comments

light24bulbs picture light24bulbs  路  41Comments

mayefeng picture mayefeng  路  44Comments