xojs/xo

Should the `useEslintrc` option be documented? #338

tony-kerz posted onGitHub

i have been using this for a while as i find it a convenient way to tweak eslint settings via eslint conventions, and i just noticed that it wasn't mentioned in the documentation.

should this be documented or is its longevity suspect?

thx!


If that works it’s a bug. We don’t intend to support that option and it might cause other unforeseen issues. We should prevent its usage.

posted by sindresorhus over 6 years ago

from my perspective, reasons i like this option:

  1. i can use a dot-js file for (i.e. .eslintrc.js) which i find cleaner to work with than json (i.e. package.json), in terms of less double-quotes, commentability, etc.
  2. a .eslintrc file positions for portability (historically, i have had to temporarily eject from xo because of transient issues)
  3. it aligns with the prettier strategy which honors .prettierrc config and then falls back to settings in package.json

but, just so i understand your position, you were thinking that xo would ignore any kind of .eslintrc config, and xo users would be required to disperse config that could otherwise go there into an eslintConfig section or in an xo[.rules] section in package.json...?

posted by tony-kerz over 6 years ago

i can use a dot-js file for (i.e. .eslintrc.js) which i find cleaner to work with than json (i.e. package.json), in terms of less double-quotes, commentability, etc.

We plan to support that by using cosmiconfig. See: https://github.com/xojs/xo/pull/279#issuecomment-407250935

but, just so i understand your position, you were thinking that xo would ignore any kind of .eslintrc config, and xo users would be required to disperse config that could otherwise go there into an eslintConfig section or in an xo[.rules] section in package.json...?

Yes. XO needs full control of how you define rules as we do a lot extra stuff with them. We could support .eslintrc (we won't though), but that would need to be an actual XO option and not something that is just accidentally passed through to ESLint.

posted by sindresorhus over 6 years ago

thanks sindre,

i think i'm with ya, so:

  • this proposal would allow, for instance, a .xo.js file to be found at the root of the project with stuff like?:
{
  parser: 'babel-eslint',
  env: ['browser'],
  rules: {
    'capitalized-comments': 0,
    'react/prop-types': 0,
    'no-unused-expressions': 0,
    'prefer-rest-params': 0
  }
}
  • is there a pass-thru for parserOptions like these, or are they supposed to be derived?:
{
  parserOptions: {
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true,
      experimentalObjectRestSpread: true
    }
  }
}

best, tony.

posted by tony-kerz over 6 years ago

@issuehunt has funded $40.00 to this issue.


posted by IssueHuntBot almost 6 years ago

@sindresorhus has rewarded $36.00 to @richienb. See it on IssueHunt

  • :moneybag: Total deposit: $40.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $4.00
posted by issuehunt-app[bot] almost 4 years ago

Fund this Issue

$40.00
Rewarded

Rewarded pull request

Recent activities

richienb was rewarded by sindresorhus for xojs/xo# 338
almost 4 years ago
richienb submitted an output to  xojs/ xo# 338
almost 4 years ago