Repository navigation
Replies: 8 comments
|
Use an external flat config with npm --prefix ~/.config/eslint-runner i eslint @eslint/js globals
npm --prefix ~/.config/eslint-runner exec eslint -- \
-c ~/.config/eslint-runner/eslint.config.mjs /path/to/index.jsPut |
|
Actually meant not littering the folder with So one has to make shell aliases, then? No shorthand way to run the tool natively? (Including integrating with Emacs flycheck) |
|
Right, there is no ESLint-native shorthand for "use this installed tool/config bundle from another directory". ESLint can either skip config lookup with In practice the clean version is a wrapper/alias, for example: eslint-global() {
npm --prefix "$HOME/.config/eslint-runner" exec eslint -- \
--config "$HOME/.config/eslint-runner/eslint.config.mjs" "$@"
}For Flycheck, point the ESLint executable variable at a small wrapper script using the same command. That keeps both |
|
Thanks! Hope this will be useful for others. And I do think that the (any!) program should either accept the absence of a config file, or at the very least create one. Is there a reason for this pickiness? |
|
The short reason is that ESLint is config-driven by design: a default config would have to guess too much about the program being linted, like browser vs Node globals, module/script mode, JSX/TS support, plugins, and which rules should actually be errors. In v9 the default config system is flat config, so the CLI has three explicit modes: find an |
|
On the other hand it runs a full interrogation on installation ("What will you use it for?" and half a dozen other questions) without explaining whether this is a poll or to assist setup. Would prefer this gone, but if it's here to stay, wouldn't picking one out of three typical configs belong here? |
|
Thanks for sharing this knowledge! Will try next time. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
What are the alternatives for a global installation?
The following does work:
Provided one resourcefully excavates an internet snippet that passes as a functioning config file:
(It really would be an asset were the user provided with a good default config, rather than this headache-inducer ...)
And the second you try to plug
@eslint/jsand friends, it's hello again, migraine.All reactions