intlify / eslint-plugin-svelte Goto Github PK
View Code? Open in Web Editor NEWESLint plugin for internationalization with Svelte
License: MIT License
ESLint plugin for internationalization with Svelte
License: MIT License
Would it be possible to provide a config that will work with the new flat config format in eslint v9?
I see that support was added in this PR: #12
However, when I look at the code I don't see an exported config that is compatible with v9. All the exported configs use the old "extends" format https://github.com/intlify/eslint-plugin-svelte/blob/main/lib/configs/recommended.ts. I could totally be missing it though.
Thanks!
Tell us about your environment
Please show your full configuration:
/** @type { import("eslint").Linter.Config } */
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier',
'plugin:@intlify/svelte/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', '@intlify/svelte', 'unused-imports'],
rules: {
// False positives under svelte 5 with generics
'no-undef': 'off',
// False positives under svelte 5 with vars named $page etc
'svelte/valid-compile': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error', // or "error"
{
// Variables starting underscores are allowed, becuase it is frequently used
// Variables starging with $$ are allowed, since shadcn uses it internally (generated code that we edit)
argsIgnorePattern: '^_',
varsIgnorePattern: '^(_|\\$\\$)',
caughtErrorsIgnorePattern: '^_',
},
],
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^(_|\\$\\$)',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte'],
},
env: {
browser: true,
es2017: true,
node: true,
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
},
},
],
}
What did you do?
1: Created a style-tag with some css in a .svelte-file
2: run eslint on the file ./node_modules/.bin/eslint src/routes/test.svelte
<h1>Text</h1>
<style>
h1 {
background: blue;
}
</style>
What did you expect to happen?
I expected no errors for the style-tag
What actually happened?
I got a warning from @intlify/svelte/no-raw-text
for the css.
./src/routes/test.svelte
1:5 warning raw text 'Text' is used @intlify/svelte/no-raw-text
3:8 warning raw text 'h1 {
background: blue;
}' is used @intlify/svelte/no-raw-text
โ 2 problems (0 errors, 2 warnings)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.