Skip to content

Commit ed5d765

Browse files
committed
wip
1 parent 38a963b commit ed5d765

File tree

4 files changed

+52
-93
lines changed

4 files changed

+52
-93
lines changed

README.md

Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
# Introduction
2-
3-
`eslint-plugin-svelte` is the official [ESLint] plugin for [Svelte].
4-
It provides many unique check rules by using the template AST.
5-
You can check on the [Online DEMO](https://eslint-online-playground.netlify.app/#eslint-plugin-svelte%20with%20typescript).
6-
7-
> [!NOTE]
8-
> This document is in development.\
9-
> Please refer to the document for the version you are using.\
10-
> For example, <https://github.com/sveltejs/eslint-plugin-svelte/blob/eslint-plugin-svelte%402.46.0/README.md>
11-
> and <https://github.com/sveltejs/eslint-plugin-svelte/blob/eslint-plugin-svelte%402.46.0/docs>
1+
<!--DOCS_IGNORE_START-->
122

133
[![NPM license](https://img.shields.io/npm/l/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte)
144
[![NPM version](https://img.shields.io/npm/v/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte)
@@ -24,52 +14,48 @@ You can check on the [Online DEMO](https://eslint-online-playground.netlify.app/
2414
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
2515
[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/atlassian/changesets)
2616

27-
## :name_badge: What is this plugin?
17+
<div align="center">
2818

29-
[ESLint] plugin for [Svelte].
30-
It provides many unique check rules using the AST generated by [svelte-eslint-parser].
19+
# eslint-plugin-svelte
3120

32-
### ❗ Attention
21+
### ESLint plugin for Svelte using AST
3322

34-
#### Cannot be used with eslint-plugin-svelte3
23+
[Live Demo](https://eslint-online-playground.netlify.app/#eslint-plugin-svelte%20with%20typescript)
24+
[Documentation](https://sveltejs.github.io/eslint-plugin-svelte/)
25+
[Discord](https://svelte.dev/chat)
3526

36-
The [svelte-eslint-parser] and the `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3].
27+
</div>
3728

38-
[svelte-eslint-parser]: https://github.com/sveltejs/svelte-eslint-parser
39-
[eslint-plugin-svelte3]: https://github.com/sveltejs/eslint-plugin-svelte3
40-
41-
#### Experimental support for Svelte v5
29+
<!--DOCS_IGNORE_END-->
4230

43-
We are working on support for Svelte v5, but it is still an experimental feature. Please note that rules and features related to Svelte v5 may be changed or removed in minor versions without notice.
31+
# Introduction
4432

45-
<!--DOCS_IGNORE_START-->
33+
`eslint-plugin-svelte` is the official [ESLint](https://eslint.org/) plugin for [Svelte](https://svelte.dev/).
34+
It offers a variety of unique linting rules by leveraging the AST generated by [svelte-eslint-parser](https://github.com/sveltejs/svelte-eslint-parser).
35+
It provides a variety of unique linting rules by utilizing the template AST.
4636

47-
## Versioning policy
37+
> [!WARNING]
38+
> The [svelte-eslint-parser](https://github.com/sveltejs/svelte-eslint-parser) and `eslint-plugin-svelte` cannot be used alongside [eslint-plugin-svelte3](https://github.com/sveltejs/eslint-plugin-svelte3).
4839
49-
This plugin follows [Semantic Versioning](https://semver.org/).
50-
However, unlike [ESLint’s Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy), this plugin adds new rules to its configs even in minor releases. For example, if you are using the recommended config, a minor update may add new rules, which could cause new lint errors in your project.
51-
While [ESLint’s Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy) only adds new rules to configs in major releases, most users (myself included) don’t regularly monitor new rules. This makes it challenging to manually add them to projects whenever they are introduced.
52-
By adding new rules to configs in minor releases, this plugin ensures users can adopt them more easily. If any new rules cause issues, you can simply disable them. I believe this approach helps maintain and improve code quality with minimal effort.
40+
<!--DOCS_IGNORE_START-->
5341

5442
## Migration Guide
5543

5644
To migrate from `eslint-plugin-svelte` v1, or [`@ota-meshi/eslint-plugin-svelte`](https://www.npmjs.com/package/@ota-meshi/eslint-plugin-svelte), please refer to the [migration guide](https://sveltejs.github.io/eslint-plugin-svelte/migration/).
5745

58-
## :book: Documentation
59-
60-
See [documents](https://sveltejs.github.io/eslint-plugin-svelte/).
46+
## Installation
6147

62-
## :cd: Installation
48+
> [!NOTE]
49+
>
50+
> **Requirements**
51+
>
52+
> - ESLint v8.57.1, v9.0.0, and above
53+
> - Node.js v18.20.4, v20.18.0, v22.10.0, and above
6354
6455
```bash
6556
npm install --save-dev eslint eslint-plugin-svelte svelte
6657
```
6758

68-
> **Requirements**
69-
>
70-
> - ESLint v8.57.1, v9.0.0 and above
71-
> - Node.js v18.20.4, v20.18.0, v22.10.0 and above
72-
7359
<!--DOCS_IGNORE_END-->
7460

7561
## :book: Usage
@@ -283,13 +269,13 @@ export default [
283269
];
284270
```
285271

286-
## :computer: Editor Integrations
272+
## Editor Integrations
287273

288274
### Visual Studio Code
289275

290-
Use the [dbaeumer.vscode-eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension that Microsoft provides officially.
276+
Use the [dbaeumer.vscode-eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension provided officially by Microsoft.
291277

292-
You have to configure the `eslint.validate` option of the extension to check `.svelte` files, because the extension targets only `*.js` or `*.jsx` files by default.
278+
You need to configure the `eslint.validate` option in the extension settings to include `.svelte` files, as the extension only targets `*.js` and `*.jsx` files by default.
293279

294280
Example **.vscode/settings.json**:
295281

@@ -302,6 +288,17 @@ Example **.vscode/settings.json**:
302288
<!--USAGE_GUIDE_END-->
303289
<!--USAGE_SECTION_END-->
304290

291+
<!--DOCS_IGNORE_START-->
292+
293+
## Versioning policy
294+
295+
This plugin follows [Semantic Versioning](https://semver.org/).
296+
However, unlike [ESLint’s Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy), this plugin adds new rules to its configs even in minor releases. For example, if you are using the recommended config, a minor update may add new rules, which could cause new lint errors in your project.
297+
While [ESLint’s Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy) only adds new rules to configs in major releases, most users (myself included) don’t regularly monitor new rules. This makes it challenging to manually add them to projects whenever they are introduced.
298+
By adding new rules to configs in minor releases, this plugin ensures users can adopt them more easily. If any new rules cause issues, you can simply disable them. I believe this approach helps maintain and improve code quality with minimal effort.
299+
300+
<!--DOCS_IGNORE_END-->
301+
305302
## :white_check_mark: Rules
306303

307304
<!-- prettier-ignore-start -->
@@ -453,21 +450,17 @@ These rules relate to this plugin works:
453450

454451
<!--DOCS_IGNORE_START-->
455452

456-
## :beers: Contributing
457-
458-
Welcome contributing!
459-
460-
Please use GitHub's Issues/PRs.
453+
## Contributing
461454

462-
See also [CONTRIBUTING.md](./CONTRIBUTING.md)
455+
Contributions are welcome! Feel free to use GitHub Issues or submit a Pull Request (PR). For more details, see [CONTRIBUTING.md](./CONTRIBUTING.md).
463456

464457
### Working With Rules
465458

466-
This plugin uses [svelte-eslint-parser](https://github.com/sveltejs/svelte-eslint-parser) for the parser. Check [here](https://sveltejs.github.io/svelte-eslint-parser/) to find out about AST.
459+
This plugin uses [svelte-eslint-parser](https://github.com/sveltejs/svelte-eslint-parser) as its parser. Check the [AST documentation](https://sveltejs.github.io/svelte-eslint-parser/) to learn more about the AST structure.
467460

468461
<!--DOCS_IGNORE_END-->
469462

470-
## :lock: License
463+
## License
471464

472465
See the [LICENSE](LICENSE) file for license rights and limitations (MIT).
473466

docs/README.md

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,12 @@ title: 'eslint-plugin-svelte'
44

55
# Introduction
66

7-
`eslint-plugin-svelte` is the official [ESLint] plugin for [Svelte].
8-
It provides many unique check rules by using the template AST.
9-
You can check on the [Online DEMO](https://eslint-online-playground.netlify.app/#eslint-plugin-svelte%20with%20typescript).
7+
`eslint-plugin-svelte` is the official [ESLint](https://eslint.org/) plugin for [Svelte](https://svelte.dev/).
8+
It offers a variety of unique linting rules by leveraging the AST generated by [svelte-eslint-parser](https://github.com/sveltejs/svelte-eslint-parser).
9+
It provides a variety of unique linting rules by utilizing the template AST.
1010

11-
> [!NOTE]
12-
> This document is in development.\
13-
> Please refer to the document for the version you are using.\
14-
> For example, <https://github.com/sveltejs/eslint-plugin-svelte/blob/eslint-plugin-svelte%402.46.0/README.md>
15-
> and <https://github.com/sveltejs/eslint-plugin-svelte/blob/eslint-plugin-svelte%402.46.0/docs>
16-
17-
[![NPM license](https://img.shields.io/npm/l/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte)
18-
[![NPM version](https://img.shields.io/npm/v/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte)
19-
[![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads&colorB=green&suffix=/day&query=$.downloads&uri=https://api.npmjs.org//downloads/point/last-day/eslint-plugin-svelte&maxAge=3600)](http://www.npmtrends.com/eslint-plugin-svelte)
20-
[![NPM downloads](https://img.shields.io/npm/dw/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte)
21-
[![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte)
22-
[![NPM downloads](https://img.shields.io/npm/dy/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte)
23-
[![NPM downloads](https://img.shields.io/npm/dt/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte)
24-
[![Build Status](https://github.com/sveltejs/eslint-plugin-svelte/workflows/CI/badge.svg?branch=main)](https://github.com/sveltejs/eslint-plugin-svelte/actions?query=workflow%3ACI)
25-
26-
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fsveltejs%2Feslint-plugin-svelte%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
27-
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
28-
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
29-
[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/atlassian/changesets)
30-
31-
## :name_badge: What is this plugin?
32-
33-
[ESLint] plugin for [Svelte].
34-
It provides many unique check rules using the AST generated by [svelte-eslint-parser].
35-
36-
### ❗ Attention
37-
38-
#### Cannot be used with eslint-plugin-svelte3
39-
40-
The [svelte-eslint-parser] and the `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3].
41-
42-
[svelte-eslint-parser]: https://github.com/sveltejs/svelte-eslint-parser
43-
[eslint-plugin-svelte3]: https://github.com/sveltejs/eslint-plugin-svelte3
44-
45-
#### Experimental support for Svelte v5
46-
47-
We are working on support for Svelte v5, but it is still an experimental feature. Please note that rules and features related to Svelte v5 may be changed or removed in minor versions without notice.
11+
> [!WARNING]
12+
> The [svelte-eslint-parser](https://github.com/sveltejs/svelte-eslint-parser) and `eslint-plugin-svelte` cannot be used alongside [eslint-plugin-svelte3](https://github.com/sveltejs/eslint-plugin-svelte3).
4813
4914
## :book: Usage
5015

@@ -56,7 +21,7 @@ See [User Guide](./user-guide.md).
5621
See [Available Rules](./rules.md).
5722
<!-- prettier-ignore-end -->
5823

59-
## :lock: License
24+
## License
6025

6126
See the [LICENSE](https://github.com/sveltejs/eslint-plugin-svelte/blob/main/LICENSE) file for license rights and limitations (MIT).
6227

docs/user-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ export default [
228228
];
229229
```
230230

231-
## :computer: Editor Integrations
231+
## Editor Integrations
232232

233233
### Visual Studio Code
234234

235-
Use the [dbaeumer.vscode-eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension that Microsoft provides officially.
235+
Use the [dbaeumer.vscode-eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension provided officially by Microsoft.
236236

237-
You have to configure the `eslint.validate` option of the extension to check `.svelte` files, because the extension targets only `*.js` or `*.jsx` files by default.
237+
You need to configure the `eslint.validate` option in the extension settings to include `.svelte` files, as the extension only targets `*.js` and `*.jsx` files by default.
238238

239239
Example **.vscode/settings.json**:
240240

packages/eslint-plugin-svelte/tools/update-readme.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ ${newReadme
3838
)
3939
.replace(/<!--DOCS_IGNORE_START-->[\s\S]*?<!--DOCS_IGNORE_END-->/gu, '')
4040
.replace(
41-
/\(https:\/\/sveltejs.github.io\/eslint-plugin-svelte(.*?)\)/gu,
41+
/\(https:\/\/sveltejs.github.io\/eslint-plugin-svelte\/(.+)\)/gu,
4242
(_ptn, filepath: string) => {
4343
const [hash] = /(?:#.*)?$/u.exec(filepath)!;
4444
const pathWithoutHash = hash ? filepath.slice(0, -hash.length) : filepath;
4545
const normalizePathWithoutHash = pathWithoutHash.replace(/\/$/u, '');
46+
4647
const [file] = /[^/]+$/u.exec(normalizePathWithoutHash)!;
4748
const pathWithoutFile = file
4849
? normalizePathWithoutHash.slice(0, -file.length)

0 commit comments

Comments
 (0)