Skip to content

Commit

Permalink
all config (#407)
Browse files Browse the repository at this point in the history
Co-authored-by: detachhead <detachhead@users.noreply.github.com>
  • Loading branch information
DetachHead and DetachHead committed Mar 18, 2023
1 parent 09b01ad commit c394a80
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/all-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-svelte": minor
---

add `all` config which enables every rule
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ This plugin provides configs:
- `plugin:svelte/base` ... Configuration to enable correct Svelte parsing.
- `plugin:svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior.
- `plugin:svelte/prettier` ... Turns off rules that may conflict with [Prettier](https://prettier.io/) (You still need to configure prettier to work with svelte yourself, for example by using [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte).).
- `plugin:svelte/all` ... All rules. This configuration is not recommended for production use because it changes with every minor and major version of `eslint-plugin-svelte`. Use it at your own risk.

See [the rule list](https://ota-meshi.github.io/eslint-plugin-svelte/rules/) to get the `rules` that this plugin provides.

Expand Down
1 change: 1 addition & 0 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ This plugin provides configs:
- `plugin:svelte/base` ... Configuration to enable correct Svelte parsing.
- `plugin:svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior.
- `plugin:svelte/prettier` ... Turns off rules that may conflict with [Prettier](https://prettier.io/) (You still need to configure prettier to work with svelte yourself, for example by using [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte).).
- `plugin:svelte/all` ... All rules. This configuration is not recommended for production use because it changes with every minor and major version of `eslint-plugin-svelte`. Use it at your own risk.

See [the rule list](./rules.md) to get the `rules` that this plugin provides.

Expand Down
11 changes: 11 additions & 0 deletions src/configs/all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import path from "path"
import { rules } from "../utils/rules"
const base = require.resolve("./base")
const baseExtend =
path.extname(`${base}`) === ".ts" ? "plugin:svelte/base" : base
export = {
extends: [baseExtend],
rules: Object.fromEntries(
rules.map((rule) => [`svelte/${rule.meta.docs.ruleName}`, "error"]),
),
}
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { rules as ruleList } from "./utils/rules"
import base from "./configs/base"
import recommended from "./configs/recommended"
import prettier from "./configs/prettier"
import all from "./configs/all"
import * as processor from "./processor"

const configs = {
base,
recommended,
prettier,
all,
}

const rules = ruleList.reduce((obj, r) => {
Expand Down

0 comments on commit c394a80

Please sign in to comment.