I am trying to configure eslint with a coffeescript file with the following code. But so far the configuration is not being read correctly.
# .eslintrc.js
require('coffeescript/register')
require('./.eslintrc.coffee')
# .eslintrc.coffee
config =
root: true
env:
node: true
extends: [
'plugin:prettier/recommended'
'plugin:vue/recommended'
'@vue/standard'
]
parserOptions:
parser: 'babel-eslint'
rules:
'prettier/prettier': 'error'
'no-console': if process.env.NODE_ENV == 'production' then 'error' else 'off'
'no-debugger': if process.env.NODE_ENV == 'production' then 'error' else 'off'
module.exports = config
Unfortunately, this is the result.
$ ./node_modules/.bin/eslint --print-config test.js
{
"env": {},
"globals": {},
"parser": null,
"parserOptions": {},
"plugins": [],
"rules": {},
"settings": {}
}
Other things I've tried unsuccessfully are:
# .eslintrc.js
require('coffeescript/register')
module.exports = require('./.eslintrc.coffee')
# .eslintrc.coffee
config =
root: true
env:
node: true
extends: [
'plugin:prettier/recommended'
'plugin:vue/recommended'
'@vue/standard'
]
parserOptions:
parser: 'babel-eslint'
rules:
'prettier/prettier': 'error'
'no-console': if process.env.NODE_ENV == 'production' then 'error' else 'off'
'no-debugger': if process.env.NODE_ENV == 'production' then 'error' else 'off'
I'm posting an answer since I couldn't find it anywhere:
# .eslintrc.js
require('coffeescript/register')
module.exports = require('./.eslintrc.coffee')
# .eslintrc.coffee
module.exports =
root: true
env:
node: true
extends: [
'plugin:prettier/recommended'
'plugin:vue/recommended'
'@vue/standard'
]
parserOptions:
parser: 'babel-eslint'
rules:
'prettier/prettier': 'error'
'no-console': if process.env.NODE_ENV == 'production' then 'error' else 'off'
'no-debugger': if process.env.NODE_ENV == 'production' then 'error' else 'off'
That's right, requires double module.exports
.
I'm too far gone in other languages to know why...
$ ./node_modules/.bin/eslint --print-config test.js
{
"env": {
"node": true,
"es6": true,
"browser": true
},
"globals": {
"document": false,
"navigator": false,
"window": false
},
"parser": "/home/worthlessjavascriptcomma/test/node_modules/vue-eslint-parser/index.js",
"parserOptions": {
"parser": "babel-eslint",
"ecmaVersion": 2018,
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"prettier",
"vue",
"standard",
"promise",
"node",
"import"
],
...
Does someone has another option?