tatsu
tatsu

Reputation: 2536

Disable compiling including lint or linter

Im having issues building my website (built from vue-cli scaffolding) which is meant to also be homework for students.

Linter rules such as tabulation and extra spaces are causing the app to display them as a fatal error.

Code and syntax violations sure why not but spaces and tabs?

This will be impossible for the students.

How can I decide what linter rules get included in the webpack/babel compilation and which ones are ignored?

Upvotes: 0

Views: 1823

Answers (1)

webnoob
webnoob

Reputation: 15934

Take a look at the eslint config page. You'll be able to configure the rules using .eslintrc.js. You can also define paths that won't be linted using a .eslintignore file.

As an example, this is the one I'm using in my current project:

module.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    sourceType: 'module'
  },
  env: {
    browser: true
  },
  // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
  extends: [
    'standard'
  ],
  // required to lint *.vue files
  plugins: [
    'html',
    'import'
  ],
  globals: {
    'cordova': true,
    'DEV': true,
    'PROD': true,
    '__THEME': true
  },
  // add your custom rules here
  'rules': {
    // allow paren-less arrow functions
    'arrow-parens': 0,
    'one-var': 0,
    'import/first': 0,
    'import/named': 2,
    'import/namespace': 2,
    'import/default': 2,
    'import/export': 2,
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
    'brace-style': [2, '1tbs', { 'allowSingleLine': true }],
    'no-return-assign': 0
  }
}

And my ignore file:

build/*.js
config/*.js
dist/*.js

Upvotes: 1

Related Questions