-
-
Notifications
You must be signed in to change notification settings - Fork 696
Description
Tell us about your environment
- ESLint Version: 4.12.1
- eslint-plugin-vue Version: 4.0.0.beta.2
- Node Version: 9.2.0
Please show your full configuration:
module.exports = {
plugins: [
'jest'
],
extends: [
'eslint:recommended',
'plugin:jest/recommended',
'plugin:vue/recommended',
'standard'
],
env: {
'jest/globals': true
}
}
What did you do? Please include the actual source code causing the issue.
Tried testing my ESLint config via Jest.
const { CLIEngine } = require('eslint')
const configFile = require.resolve('../.eslintrc.js')
const engine = new CLIEngine({ configFile })
test('should include required parser options', () => {
const config = engine.getConfigForFile(configFile)
expect(config.parserOptions.ecmaVersion).toBeGreaterThanOrEqual(6)
expect(config.parserOptions).toHaveProperty('sourceType', 'module')
})
test('should include required environments', () => {
const config = engine.getConfigForFile(configFile)
expect(config.env).toHaveProperty('browser', true)
expect(config.env).toHaveProperty('es6', true)
expect(config.env).toHaveProperty('node', true)
})
test('should include required plugins', () => {
const config = engine.getConfigForFile(configFile)
expect(config.plugins).toContain('jest')
expect(config.plugins).toContain('vue')
})
What did you expect to happen?
Config to load correctly, tests to pass.
What actually happened? Please include the actual, raw output from ESLint.
Failed to load config "plugin:vue/recommended" to extend from.
Referenced from: /mnt/c/Users/kwilliams/Projects/eslint-config/.eslintrc.js
at configMissingError (node_modules/eslint/lib/config/config-file.js:187:19)
at loadConfigFile (node_modules/eslint/lib/config/config-file.js:213:27)
at loadFromDisk (node_modules/eslint/lib/config/config-file.js:486:18)
at load (node_modules/eslint/lib/config/config-file.js:550:20)
at configExtends.reduceRight (node_modules/eslint/lib/config/config-file.js:421:36)
at Array.reduceRight (<anonymous>)
at applyExtends (node_modules/eslint/lib/config/config-file.js:403:28)
at loadFromDisk (node_modules/eslint/lib/config/config-file.js:514:22)
at Object.load (node_modules/eslint/lib/config/config-file.js:550:20)
at Config.loadSpecificConfig (node_modules/eslint/lib/config.js:139:46)
at new Config (node_modules/eslint/lib/config.js:101:14)
at new CLIEngine (node_modules/eslint/lib/cli-engine.js:420:23)
at Object.<anonymous> (__tests__/eslintrc.test.js:4:16)
at Generator.next (<anonymous>)
at new Promise (<anonymous>)
at Generator.next (<anonymous>)
at <anonymous>
The reason this happens is that the requireindex
dependency checks filenames against require.extensions
(1), which is deprecated. When running Jest, require.extensions
is empty, and thus the config files never get loaded (2). requireindex
hasn't been updated since 2014. Can we look for a suitable replacement, or would it make sense to integrate it into the plugin's codebase as a utility function without require.extensions
?
- https://github.com/stephenhandley/requireindex/blob/master/index.js#L45
- https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/index.js#L7
Edit: Looks like this issue was brought up with Jest already: jestjs/jest#2017. Given that this is still an issue, and I feel it is more proper to move away from deprecated API anyway, I still think the best solution would be to stop using requireindex
.