mightyiam/eslint-config-love

Unexpected top-level property "languageOptions"

Closed this issue · 3 comments

I'm using:

eslint-config-love": "48.0.0"

When i run

npx eslint .

the console shows me this error:

Oops! Something went wrong! :(
ESLint: 8.57.0
Error: ESLint configuration in .eslintrc.json » eslint-config-love is invalid:
        - Unexpected top-level property "languageOptions".

This is my .eslitrc.json file:

{
  "extends": "love",
  "overrides": [{
      "files": ["*.js", "*.ts"]
  }]
}

This error doesn't occur with:

eslint-config-love": "47.0.0"

using the same .eslintrc.json configuration

Make sure you're using ESLint flat configuration. Or the compatibility utility, if you can't do that, yet.

@mightyiam can you give more information, this seems to happen to more people and I am not sure where to go from there -- I will obviously google but this could be improved, because I think most of the .js configuration is a suggestion from this repo , -- meaning, what was suggested before is now not a reality anymore or needs to be addressed/migrated to something else.

EDIT: after reading current README it was a little bit more clearer. So I would suggest people to read that :)

Thanks for the help, in order to solve this I change the config file name to: eslint.config.cjs and put this config:

const love = require('eslint-config-love')
module.exports = [
    {
        ...love,
        files: ['src/*.{js,ts,tsx,jsx}'],
        rules: {
            ...love.rules
        }
    }
]

With this I was able to run

npx eslint .

Now, if someone wants to fix the files on save you need to config the vscode eslint plugin depending on its version,
if the vscode extension version is the pre-release 3.0.5 you need to add this to you settings.json:

{
  //your editor config,
  "eslint.useFlatConfig": true,
}

and if the extension version is behind the pre-release you need you use:

{
  //your editor config,
  "eslint.experimental.useFlatConfig":true
}