Skip to content

Commit

Permalink
feat: add name to flat configs. (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored Jun 19, 2024
1 parent ea25e3e commit 580f44f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/six-tips-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-svelte": patch
---

feat: add name to flat configs.
1 change: 1 addition & 0 deletions packages/eslint-plugin-svelte/src/configs/flat/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import base from './base';
export default [
...base,
{
name: 'svelte:all:rules',
rules: Object.fromEntries(
rules
.map((rule) => [`svelte/${rule.meta.docs.ruleName}`, 'error'])
Expand Down
2 changes: 2 additions & 0 deletions packages/eslint-plugin-svelte/src/configs/flat/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import type { ESLint } from 'eslint';
export default [
{
name: 'svelte:base:setup-plugin',
plugins: {
get svelte(): ESLint.Plugin {
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore
Expand All @@ -12,6 +13,7 @@ export default [
}
},
{
name: 'svelte:base:setup-for-svelte',
files: ['*.svelte', '**/*.svelte'],
languageOptions: {
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-svelte/src/configs/flat/prettier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import base from './base';
export default [
...base,
{
name: 'svelte:prettier:turn-off-rules',
rules: {
// eslint-plugin-svelte rules
'svelte/first-attribute-linebreak': 'off',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import base from './base';
export default [
...base,
{
name: 'svelte:recommended:rules',
rules: {
// eslint-plugin-svelte rules
'svelte/comment-directive': 'error',
Expand Down
6 changes: 5 additions & 1 deletion packages/eslint-plugin-svelte/tools/update-rulesets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,16 @@ const baseContent = `/*
import type { ESLint } from 'eslint';
export default [
{
name: 'svelte:base:setup-plugin',
plugins: {
get svelte(): ESLint.Plugin {
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore
return require("../../index")
}
},
},
{
name: 'svelte:base:setup-for-svelte',
files: ["*.svelte", "**/*.svelte"],
languageOptions: {
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore
Expand Down Expand Up @@ -158,6 +160,7 @@ import base from "./base"
export default [
...base,
{
name: 'svelte:recommended:rules',
rules: {
// eslint-plugin-svelte rules
${rules
Expand Down Expand Up @@ -186,6 +189,7 @@ import base from "./base"
export default [
...base,
{
name: 'svelte:prettier:turn-off-rules',
rules: {
// eslint-plugin-svelte rules
${rules
Expand Down

0 comments on commit 580f44f

Please sign in to comment.