I’m struggling in a new little project that I’ve created to get eslint working properly. I’ve got SublimeLinter
and SublimeLinter-contrib-eslint_d
installed (and actually SublimeLinter-eslint
but I’m not using it right now).
I keep hitting an error:
SublimeLinter: #3475 eslint .eslintrc.js ERROR:
===============================================
JSON Decode error: We expected JSON from 'eslint', but instead got this:
Error: Failed to load plugin 'jest' declared in '.eslintrc.js': Cannot find module 'eslint-plugin-jest'
Require stack:
- /home/ian/src/tf-page-to-pdf/lambda/__placeholder__.js
Referenced from: /home/ian/src/tf-page-to-pdf/lambda/.eslintrc.js
I feel like this is something to do with my project structure. As I’ve got "eslint-plugin-jest": "^26.1.4",
in my package.json
, it’s all been installed to node_modules
and I’ve configured my .eslintrc.js
file like so:
module.exports = {
env: {
node: true,
commonjs: true,
es2021: true,
'jest/globals': true,
},
plugins: ['jest'],
extends: ['eslint:recommended', 'plugin:jest/recommended'],
parserOptions: {
ecmaVersion: 'latest',
},
rules: {
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
},
};
My project structure however is:
- lambda
- pages_to_pdf
- index.js
- tests
- node_modules
- .eslintrc.js
- package.json
- yarn.lock
- ...other files
So I think I might be hitting the same problem as https://stackoverflow.com/questions/60064590/vscode-failed-to-load-plugin-cannot-find-module-eslint-plugin-prettier, but I’m not sure how to fix this in Sublime. Can anyone help? Thank you!