Skip to content

Commit

Permalink
docs: add missing backticks to sort-imports (eslint#19282)
Browse files Browse the repository at this point in the history
* docs: add missing backticks to `sort-imports`

* wip
  • Loading branch information
lumirlumir authored Dec 30, 2024
1 parent 0367a70 commit d122c8a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/src/_data/rules_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2894,7 +2894,7 @@
}
],
"docs": {
"description": "Enforce sorted import declarations within modules",
"description": "Enforce sorted `import` declarations within modules",
"recommended": false,
"frozen": true,
"url": "https://eslint.org/docs/latest/rules/sort-imports"
Expand Down
8 changes: 4 additions & 4 deletions docs/src/rules/sort-imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ related_rules:



The import statement is used to import members (functions, objects or primitives) that have been exported from an external module. Using a specific member syntax:
The `import` statement is used to import members (functions, objects or primitives) that have been exported from an external module. Using a specific member syntax:

```js
// single - Import single member.
Expand All @@ -22,18 +22,18 @@ import {foo, bar} from "my-module.js";
import * as myModule from "my-module.js";
```

The import statement can also import a module without exported bindings. Used when the module does not export anything, but runs it own code or changes the global context object.
The `import` statement can also import a module without exported bindings. Used when the module does not export anything, but runs it own code or changes the global context object.

```js
// none - Import module without exported bindings.
import "my-module.js"
```

When declaring multiple imports, a sorted list of import declarations make it easier for developers to read the code and find necessary imports later. This rule is purely a matter of style.
When declaring multiple imports, a sorted list of `import` declarations make it easier for developers to read the code and find necessary imports later. This rule is purely a matter of style.

## Rule Details

This rule checks all import declarations and verifies that all imports are first sorted by the used member syntax and then alphabetically by the first member or alias name.
This rule checks all `import` declarations and verifies that all imports are first sorted by the used member syntax and then alphabetically by the first member or alias name.

The `--fix` option on the command line automatically fixes some problems reported by this rule: multiple members on a single line are automatically sorted (e.g. `import { b, a } from 'foo.js'` is corrected to `import { a, b } from 'foo.js'`), but multiple lines are not reordered.

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/sort-imports.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @fileoverview Rule to require sorting of import declarations
* @fileoverview Rule to enforce sorted `import` declarations within modules
* @author Christian Schuller
*/

Expand All @@ -23,7 +23,7 @@ module.exports = {
}],

docs: {
description: "Enforce sorted import declarations within modules",
description: "Enforce sorted `import` declarations within modules",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/sort-imports"
Expand Down

0 comments on commit d122c8a

Please sign in to comment.