From 4c1151c2e818d94a1cf2ef81f15b75ebcc972b4a Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Thu, 27 Mar 2025 17:37:28 +0900 Subject: [PATCH 1/2] chore: add playground --- playground/eslint.config.mjs | 12 ++++++++++++ playground/package.json | 9 +++++++++ playground/src/MyComponent.svelte | 9 +++++++++ 3 files changed, 30 insertions(+) create mode 100644 playground/eslint.config.mjs create mode 100644 playground/package.json create mode 100644 playground/src/MyComponent.svelte diff --git a/playground/eslint.config.mjs b/playground/eslint.config.mjs new file mode 100644 index 0000000..8d60542 --- /dev/null +++ b/playground/eslint.config.mjs @@ -0,0 +1,12 @@ +import js from '@eslint/js' +import intlifySvelte from '@intlify/eslint-plugin-svelte' +export default [ + js.configs.recommended, + ...intlifySvelte.configs.recommended, + { + files: ['**/*.svelte', '*.svelte'], + rules: { + '@intlify/svelte/no-raw-text': 'warn' + } + } +] diff --git a/playground/package.json b/playground/package.json new file mode 100644 index 0000000..5e5f6da --- /dev/null +++ b/playground/package.json @@ -0,0 +1,9 @@ +{ + "type": "module", + "devDependencies": { + "@eslint/js": "latest", + "eslint": "latest", + "@intlify/eslint-plugin-svelte": "latest", + "svelte-i18n": "^4.0.1" + } +} diff --git a/playground/src/MyComponent.svelte b/playground/src/MyComponent.svelte new file mode 100644 index 0000000..a0d0f29 --- /dev/null +++ b/playground/src/MyComponent.svelte @@ -0,0 +1,9 @@ + + + +

hello

+ + +

{ $t('hello') }

From 0e8c190db5c9dc0a571001f1b0c4a827f52250d1 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Thu, 27 Mar 2025 17:46:56 +0900 Subject: [PATCH 2/2] update --- README.md | 6 ++++++ docs/README.md | 16 ++-------------- docs/rules/README.md | 2 +- lib/configs/flat/base.ts | 2 +- scripts/update-docs-index.ts | 2 +- scripts/update-flat-base-config.ts | 2 +- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 0597011..4d248db 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,12 @@

ESLint plugin for internationalization with Svelte

+

+ +[Online Demo](https://eslint-online-playground.netlify.app/#https://github.com/intlify/eslint-plugin-svelte/tree/main/playground) + +

+ ## :book: Documentation See [here](https://github.com/intlify/eslint-plugin-svelte/blob/main/docs/README.md) diff --git a/docs/README.md b/docs/README.md index 2fb2116..0d69ea7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,18 +2,6 @@ @intlify/eslint-plugin-svelte is ESLint plugin for internationalization with Svelte. It easily integrates some localization features to your Svelte Application. -Go to [Get Started](./started.md) +- 👉 Go to [Get Started](./started.md) - - - - -```html - -

{$_('page.subtitle')}

- - -

Plain text cannot be replaced by multiple languages.

-``` - -
+- 👉 Try it out in [Online Demo](https://eslint-online-playground.netlify.app/#https://github.com/intlify/eslint-plugin-svelte/tree/main/playground) diff --git a/docs/rules/README.md b/docs/rules/README.md index f3792e2..5228b04 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -1,6 +1,6 @@ # Available Rules -- :star: mark: the rule which is enabled by the `plugin:@intlify/svelte/recommended` or `*.configs.["flat/recommended"]` preset. +- :star: mark: the rule which is enabled by the `*.configs.["flat/recommended"]` preset. - :black_nib: mark: the rule which is fixable by `eslint --fix` command. ## Recommended diff --git a/lib/configs/flat/base.ts b/lib/configs/flat/base.ts index 3325293..70222c4 100644 --- a/lib/configs/flat/base.ts +++ b/lib/configs/flat/base.ts @@ -12,7 +12,7 @@ export default [ }, { name: '@intlify/svelte:base:svelte', - files: ['*.svelte'], + files: ['**/*.svelte', '*.svelte'], languageOptions: { parser: parser } diff --git a/scripts/update-docs-index.ts b/scripts/update-docs-index.ts index 63da9e8..dd1a951 100644 --- a/scripts/update-docs-index.ts +++ b/scripts/update-docs-index.ts @@ -37,7 +37,7 @@ writeFileSync( resolve(import.meta.dirname, '../docs/rules/README.md'), `# Available Rules -- :star: mark: the rule which is enabled by the \`plugin:@intlify/svelte/recommended\` or \`*.configs.["flat/recommended"]\` preset. +- :star: mark: the rule which is enabled by the \`*.configs.["flat/recommended"]\` preset. - :black_nib: mark: the rule which is fixable by \`eslint --fix\` command. ${withCategories diff --git a/scripts/update-flat-base-config.ts b/scripts/update-flat-base-config.ts index 5998bff..104f960 100644 --- a/scripts/update-flat-base-config.ts +++ b/scripts/update-flat-base-config.ts @@ -18,7 +18,7 @@ export default [ }, { name: '@intlify/svelte:base:svelte', - files: ['*.svelte'], + files: ['**/*.svelte', '*.svelte'], languageOptions: { parser: parser, }