Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for non-node environments #884

Open
libkakashi opened this issue Jun 10, 2024 · 2 comments
Open

Support for non-node environments #884

libkakashi opened this issue Jun 10, 2024 · 2 comments

Comments

@libkakashi
Copy link

libkakashi commented Jun 10, 2024

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?

@tonycoco
Copy link
Contributor

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.

@libkakashi
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants