quick-lint / quick-lint-js

quick-lint-js finds bugs in JavaScript programs
https://quick-lint-js.com
GNU General Public License v3.0
1.55k stars 192 forks source link

Config per file with comments #1227

Open weary-adventurer opened 3 months ago

weary-adventurer commented 3 months ago

In ESLint, you can specify globals per file using a comment:

/* global A, B */
A = B * 2;

You also used to be able to specify an environment but it no longer works in latest releases:

/* eslint-env node */
const fs = require("fs"); // used to work but not anymore

I'm used to this comment configuration and it feels much better to use as there is no setup and it just works (unless someone decides to "deprecate" it and it stops working)

I saw that quick-lint-js also supports environment and globals with global groups, but it's part of a single configuration. It would be very useful if parts of the configuration could be parsed from the comments like ESLint used to do (at least globals and env).