SublimeLinter / SublimeLinter-eslint

This linter plugin for SublimeLinter provides an interface to ESLint
MIT License
865 stars 88 forks source link

Add eslint-plugin-react #337

Closed Prinzhorn closed 4 months ago

Prinzhorn commented 4 months ago

We just set up ESlint in a React project and SublimeLinter was complaining

package.json did not contain dependencies or devDependencies required to lint this file type. Manually set 'selector' to override this behavior, or install the required dependencies.

eslint-plugin-react itself comes with other plugins https://github.com/jsx-eslint/eslint-plugin-react/blob/51d342ba350ae7d7dabce1caa648e71926ef283f/package.json#L58

I got the list of extensions from their example config:

module.exports = [
  …
  {
    files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
  …
];
kaste commented 4 months ago

I think that LGTM!

Prinzhorn commented 4 months ago

Thanks for the quick turnaround. It does not appear to be working, I'm still getting the same error in the console.

package.json did not contain dependencies or devDependencies required to lint this file type. Manually set 'selector' to override this behavior, or install the required dependencies.

The package.json and project is here: https://github.com/mitmproxy/mitmproxy/blob/main/web/package.json

If you want to check this out locally, you can clone mitmproxy and check out the project in the web folder. Instructions for setting it up are in the https://github.com/mitmproxy/mitmproxy/blob/main/web/README.md but you likely only need npm i I would assume.

Running npm run eslint (or just ./node_modules/.bin/eslint .) works successfully.

Alternatively I'm open for pointer on how I can debug the Python code myself in my local Sublime.

Prinzhorn commented 4 months ago

Scratch that, it's working now. I swear I restarted Sublime, but I guess not. Thanks again!