Xo: How can I override `parserOptions`

Created on 21 Aug 2018  路  5Comments  路  Source: xojs/xo

I'll use xo to lint *.vue files by bable-eslint and eslint-plugin-vue.
So, I need to override parserOptions like this.
https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
Please tell me how to do it.

Most helpful comment

You can set the option directly under the xo property in your package.json

鈿狅笍 This isn't documented in the readme and placing it under settings doesn't work

All 5 comments

You can set the option directly under the xo property in your package.json or you can create a shareable config and set it there, similarly to https://github.com/xojs/eslint-config-xo-react/blob/master/index.js#L3

@sindresorhus should we create a eslint-config-xo-vue repo similar to eslint-config-xo-react?
Maybe we could start with the plugin:vue/recommended preset and parserOptions.
We would also need to add .vue files support to XO, similarly to the way we added .ts.

@pvdlg

You can set the option directly under the xo property in your package.json

Thanks, I worked as I was told and it worked fine.

should we create a eslint-config-xo-vue repo similar to eslint-config-xo-react?

I think that it would be very useful.

You can set the option directly under the xo property in your package.json

鈿狅笍 This isn't documented in the readme and placing it under settings doesn't work

I am trying to use xo to lint a monorepo with some vue projects. I have the following in my root package,json but it doesn't appear to be linting the vue files, any advice?

json "xo": { "prettier": "true", "extends": [ "plugin:vue/recommended" ], "extensions": [ ".js", ".vue" ], "ignores": [ "reports/**/*", ".nyc_output/**/*" ] }

I have of course set xo: false in all the other package.json

This way of overriding parserOptions seems to work:

{
  "xo": {
    "envs": [ /* examples */
      "browser",
      "webextensions"
    ],
    "parserOptions": {
      "ecmaScript": 3 /* `3` is just for testing, you'll see weird new errors pop up */
    }
  }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

vadimdemedes picture vadimdemedes  路  3Comments

pizzafox picture pizzafox  路  5Comments

haskellcamargo picture haskellcamargo  路  3Comments

sindresorhus picture sindresorhus  路  5Comments

sindresorhus picture sindresorhus  路  6Comments