gts icon indicating copy to clipboard operation
gts copied to clipboard

Support for non-node environments

Open libkakashi opened this issue 1 year ago • 2 comments

As of now, the default .eslintrc.json file that's extended by all projects has the following code:

{
  "extends": [
    "eslint:recommended",
    "plugin:node/recommended",
    "prettier"
  ],
  "plugins": [
    "node",
    "prettier"
  ],
  ...
}

Overwriting this to make it work with browser envs, bun, figma plugins, etc. is bit of a pain. Could we have something like a CLI flag that makes it optional to include node specific rules?

libkakashi avatar Jun 10 '24 11:06 libkakashi

Great idea. Can you provide me a diff for what makes it hard to work on a Figma plugin or something else? Also happy to check a PR on the flag if you are interested in adding this feature.

tonycoco avatar Jun 12 '24 18:06 tonycoco

Sure, I could probably work on it sometime over the weekend

One example is how imports don't work in js files even when not using node. Let's say I've a simple js file like this:

import script2 from './script2.js';

document.getElementById('button').addEventListener('click', () => {
  console.log('button clicked');
  script2();
});

I'd get an error saying error Import and export declarations are not supported yet, unless I mention "n/no-unsupported-features/es-syntax": "off" in my eslint config, even tho I'm not using node at all.

libkakashi avatar Jun 14 '24 14:06 libkakashi