-
-
Notifications
You must be signed in to change notification settings - Fork 51
Closed as not planned
Closed as not planned
Copy link
Description
What would you like?
generator-eslint should generate code aligned to the recommended rules of @stylistic/eslint-plugin
Plugin templates and rule templates are not aligned to the following recommended stylistic rules:
| Rule | Recommended |
|---|---|
| @stylistic/indent | 2 |
| @stylistic/no-multiple-empty-lines | max: 1 |
| @stylistic/quotes | single |
| @stylistic/semi | false |
| @stylistic/spaced-comment | always |
Why is this needed?
@stylistic/eslint-plugin is the reference style implementation in the ESLint ecosystem. Conforming to the recommended rules assists plugin authors to generate plugins with standardized formatting.
Other
Steps to reproduce
The following illustrates the differences for generated plugins only. The same would apply to generated rules as well.
Ubuntu 24.04.2 LTS, Node 22.16.0 LTS
generator-eslint 5.1.2
npm i -g yo@latest # 5.1.0
npm i -g generator-eslint@latest # 5.1.2
mkdir yo-eslint-plugin-test
cd yo-eslint-plugin-test
yo eslint:plugin$ yo eslint:plugin
? What is your name? Tester
? What is the plugin ID? test-stylistic
? Type a short description of this plugin: Test stylistic compatibility
? Does this plugin contain custom ESLint rules? Yes
? Does this plugin contain one or more processors? No
(node:6079) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
create package.json
create eslint.config.mjs
create lib/index.js
create README.md
Changes to package.json were detected.
Error detecting the package manager. Falling back to npm.
Running npm install for you to install the required dependencies.
added 240 packages, and audited 241 packages in 19s
68 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
In eslint.config.mjs add:
import stylistic from '@stylistic/eslint-plugin'
...
stylistic.configs.recommended,npm install @stylistic/eslint-plugin --save-devLogs
$ npx eslint
/home/mike/github/yo-eslint-plugin-test/eslint.config.mjs
1:22 error Strings must use singlequote @stylistic/quotes
1:34 error Extra semicolon @stylistic/semi
2:24 error Strings must use singlequote @stylistic/quotes
2:41 error Extra semicolon @stylistic/semi
3:26 error Strings must use singlequote @stylistic/quotes
3:55 error Extra semicolon @stylistic/semi
7:1 error Expected indentation of 2 spaces but found 4 @stylistic/indent
8:1 error Expected indentation of 2 spaces but found 4 @stylistic/indent
8:27 error Strings must use singlequote @stylistic/quotes
9:1 error Expected indentation of 2 spaces but found 4 @stylistic/indent
9:26 error Strings must use singlequote @stylistic/quotes
10:1 error Expected indentation of 2 spaces but found 4 @stylistic/indent
11:2 error Extra semicolon @stylistic/semi
/home/mike/github/yo-eslint-plugin-test/lib/index.js
5:1 error Strings must use singlequote @stylistic/quotes
5:13 error Extra semicolon @stylistic/semi
7:1 error Expected exception block, space or tab after '//' in comment @stylistic/spaced-comment
9:1 error Expected exception block, space or tab after '//' in comment @stylistic/spaced-comment
11:30 error Strings must use singlequote @stylistic/quotes
11:45 error Extra semicolon @stylistic/semi
13:1 error Expected exception block, space or tab after '//' in comment @stylistic/spaced-comment
15:1 error Expected exception block, space or tab after '//' in comment @stylistic/spaced-comment
17:1 error More than 1 blank line not allowed @stylistic/no-multiple-empty-lines
19:49 error Strings must use singlequote @stylistic/quotes
19:58 error Extra semicolon @stylistic/semi
20:1 error Too many blank lines at the end of file. Max of 0 allowed @stylistic/no-multiple-empty-lines
✖ 25 problems (25 errors, 0 warnings)
25 errors and 0 warnings potentially fixable with the `--fix` option.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Complete