tools icon indicating copy to clipboard operation
tools copied to clipboard

ESLint configuration is invalid: Unexpected top-level property "ecmaFeatures".

Open obedm503 opened this issue 9 years ago • 6 comments

I'm submitting a bug report

  • Library Version: 1.0.0

Please tell us about your environment:

  • Operating System: Linux (Xubuntu 16.04)

  • Node Version: 8.1.0

  • NPM Version: 5.0.3
  • Browser: all?

  • Language: ESNext

Current behavior: the .eslintrc.json file is only valid for eslint <2.0.0, and as such the linter fails to do it's job.

acoording to the eslint docs

Prior to 2.0.0, the way to enable language options was by using ecmaFeatures in your configuration. In 2.0.0:

  • The ecmaFeatures property is now under a top-level parserOptions property. if you run the linter you get an error:

error screenshot

and the .eslintrc.json just references aurelia-tools

{
  "extends": "./node_modules/aurelia-tools/.eslintrc.json"
}

Expected/desired behavior:

  • What is the expected behavior? that the .eslintrc.json be updated to work with the latest version of eslint. Our project is based on one of the ESNext skeletons, and their .eslintrc.json reference aurelia-tools' .eslintrc.json

  • What is the motivation / use case for changing the behavior? We need good tooling as part of "aurelia-tools"

obedm503 avatar Jun 19 '17 16:06 obedm503

I may be wrong but something worth considering would be to replace in the .eslintrc.json file

  "ecmaFeatures": {
    "arrowFunctions": true,
    "blockBindings": true,
    "classes": true,
    "defaultParams": true,
    "destructuring": true,
    "forOf": true,
    "generators": false,
    "modules": true,
    "objectLiteralComputedProperties": true,
    "objectLiteralDuplicateProperties": false,
    "objectLiteralShorthandMethods": true,
    "objectLiteralShorthandProperties": true,
    "spread": true,
    "superInFunctions": true,
    "templateStrings": true,
    "jsx": false
  }

with

  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "arrowFunctions": true,
      "blockBindings": true,
      "classes": true,
      "defaultParams": true,
      "destructuring": true,
      "forOf": true,
      "generators": false,
      "modules": true,
      "objectLiteralComputedProperties": true,
      "objectLiteralDuplicateProperties": false,
      "objectLiteralShorthandMethods": true,
      "objectLiteralShorthandProperties": true,
      "spread": true,
      "superInFunctions": true,
      "templateStrings": true,
      "jsx": false
    }
  }

chabou-san avatar Jun 21 '17 11:06 chabou-san

I can probably submit a pr. what version of ESLint does aurelia use on it's other libraries? is v4 fine?@EisenbergEffect

obedm503 avatar Jun 21 '17 16:06 obedm503

@obedm503 Please note that the modification I propose is already usable (but only recommended) for the currently used version of ESLint in Aurelia projects, that is 3.1.1 (as seen in aurelia-framework). It just becomes mandatory when someone uses ESLint v4.0.0 and above.

chabou-san avatar Jun 21 '17 18:06 chabou-san

As lont as it works with aurelia-framework and you provide us with some instructions to make any necessary updates, I think that is fine. We may want to bump our aurelia-tools by a major version if you think it will break someone.

EisenbergEffect avatar Jun 21 '17 23:06 EisenbergEffect

it's worth noting that with no changes even aurelia-tools src had some linting errors before the update

obedm503 avatar Jun 22 '17 01:06 obedm503

FIX. add to eslintrc rule: "jsx-a11y/href-no-hash": "off"

joseph-teb avatar May 11 '18 22:05 joseph-teb