Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit d92bedd

Browse files
Merge pull request #11 from AtomLinter/readme-tweaks
chore: rearrange settings, fix typos, tweak README
2 parents 71bbd3e + 24e3434 commit d92bedd

File tree

2 files changed

+37
-19
lines changed

2 files changed

+37
-19
lines changed

README.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ Two reasons:
2323

2424
Depends. The `linter-eslint` package supports **ESLint up through and including v7**. This new package supports **ESLint v7 and greater**. The overlap in v7 is because that’s the one major version where both interfaces, `CLIEngine` and `ESLint`, are available.
2525

26-
If all your projects use ESLint `>=7.0.0`, you can keep this package and uninstall `linter-eslint`. If any of your projects use an older ESLint, you should keep `linter-eslint` installed alongside this package.
26+
If _all_ your projects use ESLint `>=7.0.0`, you can keep this package and uninstall `linter-eslint`. If _any_ of your projects use an older ESLint, you should keep `linter-eslint` installed alongside this package. **This package can coexist with `linter-eslint`; they won’t get in each other’s way.**
2727

2828
Since they can both lint when ESLint 7.x is present, they have to coordinate who does the linting when both packages are installed. **If `linter-eslint` is installed, this package will not perform linting in ESLint 7.x environments** — only 8.x or greater. If only this package is installed, it will lint with any version of ESLint it supports.
2929

30+
When `linter-eslint` is not installed and this package detects an ESLint version too old for it to support, it will show a notification and invite you to install `linter-eslint`. This behavior can be disabled in package settings.
31+
3032
## How do I “bring my own Node”?
3133

3234
To run your version of Node, `linter-eslint-node` needs to know _where_ your version of Node is, and that question sometimes has a complex answer.
3335

34-
The command `Linter Eslint Node: Debug` will show a panel with the version of Node that this package will use for a particular project.
36+
The **Path to Node binary** option in this package’s settings will allow you to set the path to your node binary. It defaults to the bare value `node`, which will work if `node` is in your `PATH`.
37+
38+
The command **Linter Eslint Node: Debug** will show a panel with the version of Node that this package will use for a particular project.
3539

3640
### First: just see if it works
3741

@@ -45,13 +49,15 @@ If you manage several versions of Node using a tool like [NVM][], you might stil
4549

4650
If you do all these things, the Atom windows you spawn will inherit the environment defined by your shell, including the current value of `$PATH`.
4751

48-
It’s also likely to work if you use a version manager like [Volta][] or [asdf][] in which there’s a single “shim” executable with a consistent location.
49-
5052
### Failing that: set it explicitly
5153

52-
If you use one version of Node on your system, and this package somehow hasn’t inferred it from your `$PATH` variable, then you can use the package settings page to set Node Binary” manually. On macOS or Linux, `which node` will typically retrieve this path.
54+
If you use one version of Node on your system, and this package somehow hasn’t inferred it from your `$PATH` variable, then you can use the package settings page to set **Path to Node binary** manually. On macOS or Linux, `which node` will typically retrieve this path.
5355

54-
If you manage several versions of node with [NVM][] or a similar tool, and sometimes don’t launch a project via the terminal, you might notice this package using your the path to your NVM-default version of Node instead of the correct version for that project.
56+
This should also work if you use a Node version manager like [Volta][] or [asdf][] in which there’s a single “shim” executable with a consistent location.
57+
58+
#### Per-project settings
59+
60+
If you manage several versions of Node with [NVM][] or a similar tool, and sometimes don’t launch a project via the terminal, you might notice this package using your the path to your NVM-default version of Node instead of the correct version for that project — or else failing to see your Node binary altogether.
5561

5662
You can fix this by bypassing our heuristics and setting your Node binary path **on a per-project basis** using one of several methods.
5763

@@ -83,9 +89,13 @@ Keep in mind you’ll have to update this setting whenever you update the versio
8389

8490
## Which ESLint version will this package use?
8591

86-
`linter-eslint-node` will look for a version of `eslint` local to your project, as long as it’s at least v7.0.0. Ideally, this would be installed into a `node_modules` folder in the project root. If it’s in a different location for whatever reason, you can use the `advanced.localNodeModules` setting to specify a path (relative or absolute) in either your `config.cson` or your `.linter-eslint` file.
92+
`linter-eslint-node` will look for a version of ESLint local to your project, as long as it’s at least v7.0.0. Ideally, this would be installed into a `node_modules` folder in the project root, but it’ll find anything in `module.paths`.
93+
94+
If you can run `node -e "require('eslint')"` from your project root and not get an error, then `linter-eslint-node` should find your copy of ESLint just fine.
8795

88-
If it doesn’t find an ESLint in your project, `linter-eslint-node` will fall back to the version it ships with.
96+
If it doesn’t find an ESLint in your project, `linter-eslint-node` will fall back to the version it ships with, which is typically the most recent major release.
97+
98+
The command **Linter Eslint Node: Debug**, when run from a file inside your project, will report which version of ESLint this package would use to lint that file, and whether it’s yours or the package’s built-in version.
8999

90100
## Other configuration
91101

@@ -94,6 +104,8 @@ Common JavaScript-derivative languages (TypeScript, Flow, etc.) will also trigge
94104

95105
## Using ESLint
96106

107+
### .eslintrc
108+
97109
Recent versions of ESLint don’t use any rules by default. For all but the most basic of usages, you must create an `.eslintrc` file in your project root:
98110

99111
```ShellSession
@@ -102,9 +114,14 @@ npx eslint --init # or without "npx " if installed globally
102114

103115
You can also create the `.eslintrc` file manually. It’s a good idea to consult the [ESLint documentation](http://eslint.org/docs/user-guide/configuring), including the [list of rules](http://eslint.org/docs/rules/).
104116

117+
118+
### .eslintignore
119+
120+
An `.eslintignore` file can be used to tell ESLint that certain files should not be linted. The `eslint` command-line tool will only look for an `.eslintignore` in the directory you run it from, so this file should almost always be placed in your project root. But `linter-eslint-node`, when linting a single file, will respect the first `.eslintignore` it finds, starting from the file’s path and moving upward until it reaches the project root.
121+
105122
### Plugins
106123

107-
It’s better practice to install ESLint plugins locally in your project, but plugins installed globally will also work just fine. But keep in mind that either way you’ll need to define an `.eslintrc` file in your project that includes those plugins.
124+
It’s better practice to install ESLint plugins locally in your project, but plugins installed globally will also work just fine. Just make sure to reference those plugins in your `.eslintrc`.
108125

109126

110127
[ECMAScript modules]: https://nodejs.org/api/esm.html

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
],
3636
"configSchema": {
3737
"scopes": {
38-
"title": "List of scopes to run ESLint on. Run `Editor: Log Cursor Scope` to determine the scopes for a file. To lint JavaScript inside HTML files, add `source.js.embedded.html` to this list and be sure that `eslint-plugin-html` is installed and added to your `.eslintrc`.",
38+
"title": "List of scopes to run ESLint on",
39+
"description": "Run `Editor: Log Cursor Scope` to determine the scopes for a file. To lint JavaScript inside HTML files, add `source.js.embedded.html` to this list and be sure that `eslint-plugin-html` is installed and added to your `.eslintrc`.",
3940
"type": "array",
4041
"default": [
4142
"source.js",
@@ -51,18 +52,18 @@
5152
},
5253
"order": 1
5354
},
54-
"warnAboutOldEslint": {
55-
"title": "Warn about old ESLint versions",
56-
"description": "If your project’s ESLint is too old for this package to support, and you don’t have `linter-eslint` installed, you’ll see a single warning message after your first lint attempt, and no further messages until you reopen the project. If you’d rather not receive the warning under any circumstances, disable this option.",
57-
"type": "boolean",
58-
"default": true,
59-
"order": 2
60-
},
6155
"nodeBin": {
6256
"title": "Path to Node binary",
6357
"description": "The path to the version of Node that this linter should run. If you have one global installation of node, `which node` should give you the correct value. If you use NVM or another Node version manager, `which node` within this project's directory should give you the correct value. If you need this value to vary on a per-project basis, consult the README for various options.",
6458
"type": "string",
6559
"default": "node",
60+
"order": 2
61+
},
62+
"warnAboutOldEslint": {
63+
"title": "Warn about old ESLint versions",
64+
"description": "If your project’s ESLint is too old for this package to support, and you don’t have `linter-eslint` installed, you’ll see a single warning message after your first lint attempt, and no further messages until you reopen the project. If you’d rather not receive the warning under any circumstances, disable this option.",
65+
"type": "boolean",
66+
"default": true,
6667
"order": 3
6768
},
6869
"autofix": {
@@ -102,7 +103,7 @@
102103
"properties": {
103104
"disableWhenNoEslintConfig": {
104105
"title": "Disable when no ESLint config is found",
105-
"description": "Will do nothing when no ESLint config is found in either `.package.json` or `.eslintrc` instead of showing an error.",
106+
"description": "Will do nothing when no ESLint config is found in either `package.json` or `.eslintrc` instead of showing an error.",
106107
"type": "boolean",
107108
"default": true,
108109
"order": 1
@@ -140,7 +141,7 @@
140141
},
141142
"useCache": {
142143
"title": "Use Cache",
143-
"description": "When this package creates an instance of `ESLint` for a file, it will try to re-use that instance in the future for the same file or for other files in that directory. If you’re noticing odd behavior, disable this option and reload your window to see if it’s cache-related.",
144+
"description": "When this package creates an instance of `ESLint`, it will try to re-use that instance when linting other files in your project. If you’re noticing odd behavior, disable this option and reload your window to see if it’s cache-related.",
144145
"type": "boolean",
145146
"default": true,
146147
"order": 3

0 commit comments

Comments
 (0)