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

indent option for comments #9728

Closed
zhfish opened this issue Dec 18, 2017 · 2 comments
Closed

indent option for comments #9728

zhfish opened this issue Dec 18, 2017 · 2 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint

Comments

@zhfish
Copy link

zhfish commented Dec 18, 2017

Tell us about your environment

  • ESLint Version:4.13.1
  • Node Version:8.9.1
  • npm Version:5.6.0

What parser (default, Babel-ESLint, etc.) are you using?
Babel-ESLint
Please show your full configuration:

Configuration
// https://eslint.org/docs/user-guide/configuring

module.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    sourceType: 'module'
  },
  env: {
    browser: true,
  },
  extends: 'airbnb-base',
  // required to lint *.vue files
  plugins: [
    'html'
  ],
  // check if imports actually resolve
  settings: {
    'import/resolver': {
      webpack: {
        config: 'build/webpack.base.conf.js'
      }
    }
  },
  // add your custom rules here
  rules: {
    // don't require .vue extension when importing
    'import/extensions': ['error', 'always', {
      js: 'never',
      vue: 'never'
    }],
    // disallow reassignment of function parameters
    // disallow parameter object manipulation except for specific exclusions
    'no-param-reassign': ['error', {
      props: true,
      ignorePropertyModificationsFor: [
        'state', // for vuex state
        'acc', // for reduce accumulators
        'e' // for e.returnvalue
      ]
    }],
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-console': 'off',
    'no-else-return': 'off',
    'consistent-return' : 'off',
    'no-useless-return': 'off',
    'no-plusplus': 'off',
  }
};

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

function (
// foo,
  bar,
// boo,
  baz,
  qux
) {
  qux();
});

What did you expect to happen?

   2:1  error  Expected indentation of 2 spaces but found 0  indent
   4:1  error  Expected indentation of 2 spaces but found 0  indent

✖ 2 problems (2 errors, 0 warnings)
  2 errors, 0 warnings potentially fixable with the `--fix` option.

What actually happened? Please include the actual, raw output from ESLint.
i want the indent of comment is 0 space always.

how to set the config ?

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Dec 18, 2017
@not-an-aardvark
Copy link
Member

Hi,

At the moment, it's not possible to configure the indent rule to always allow comments with no indentation. There are a few workarounds:

  • You can switch to the indent-legacy rule, an older version of the indent rule which always ignores comments. (However, the indent-legacy rule also ignores some other types of syntax, and enforces certain indentation incorrectly.)
  • After Ignore comments option for indent rule #9018 is implemented, you will be able to ignore comments when using the indent rule.

@not-an-aardvark not-an-aardvark added question This issue asks a question about ESLint and removed triage An ESLint team member will look at this issue soon labels Dec 19, 2017
@not-an-aardvark
Copy link
Member

Closing because the question has been answered.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jul 19, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint
Projects
None yet
Development

No branches or pull requests

2 participants