Skip to content

Commit 5c7cba3

Browse files
authored
feat: limiting more rules to prevent false positives (#1299)
1 parent f999638 commit 5c7cba3

File tree

10 files changed

+64
-6
lines changed

10 files changed

+64
-6
lines changed

.changeset/quick-forks-hear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': patch
3+
---
4+
5+
feat: disabling more rules in runes mode

.changeset/rude-suns-send.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': patch
3+
---
4+
5+
feat: restricting SvelteKit rules to SvelteKit

packages/eslint-plugin-svelte/src/rules/experimental-require-slot-types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@ export default createRule('experimental-require-slot-types', {
1414
messages: {
1515
missingSlotsInterface: `The component must define the $$Slots interface.`
1616
},
17-
type: 'suggestion'
17+
type: 'suggestion',
18+
conditions: [
19+
{
20+
svelteVersions: ['3/4']
21+
},
22+
{
23+
svelteVersions: ['5'],
24+
runes: [false, 'undetermined']
25+
}
26+
]
1827
},
1928
create(context) {
2029
let isTs = false;

packages/eslint-plugin-svelte/src/rules/experimental-require-strict-events.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ export default createRule('experimental-require-strict-events', {
1616
messages: {
1717
missingStrictEvents: `The component must have the strictEvents attribute on its <script> tag or it must define the $$Events interface.`
1818
},
19-
type: 'suggestion'
19+
type: 'suggestion',
20+
conditions: [
21+
{
22+
svelteVersions: ['3/4']
23+
}
24+
]
2025
},
2126
create(context) {
2227
let isTs = false;

packages/eslint-plugin-svelte/src/rules/no-extra-reactive-curlies.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ export default createRule('no-extra-reactive-curlies', {
1515
extraCurlies: `Do not wrap reactive statements in curly braces unless necessary.`,
1616
removeExtraCurlies: `Remove the unnecessary curly braces.`
1717
},
18-
type: 'suggestion'
18+
type: 'suggestion',
19+
conditions: [
20+
{
21+
svelteVersions: ['3/4']
22+
},
23+
{
24+
svelteVersions: ['5'],
25+
runes: [false, 'undetermined']
26+
}
27+
]
1928
},
2029
create(context) {
2130
return {

packages/eslint-plugin-svelte/src/rules/no-goto-without-base.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ export default createRule('no-goto-without-base', {
1818
isNotPrefixedWithBasePath:
1919
"Found a goto() call with a url that isn't prefixed with the base path."
2020
},
21-
type: 'suggestion'
21+
type: 'suggestion',
22+
conditions: [
23+
{
24+
svelteKitVersions: ['1.0.0-next', '1', '2']
25+
}
26+
]
2227
},
2328
create(context) {
2429
return {

packages/eslint-plugin-svelte/src/rules/no-immutable-reactive-statements.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ export default createRule('no-immutable-reactive-statements', {
1616
immutable:
1717
'This statement is not reactive because all variables referenced in the reactive statement are immutable.'
1818
},
19-
type: 'suggestion'
19+
type: 'suggestion',
20+
conditions: [
21+
{
22+
svelteVersions: ['3/4']
23+
},
24+
{
25+
svelteVersions: ['5'],
26+
runes: [false, 'undetermined']
27+
}
28+
]
2029
},
2130
create(context) {
2231
const scopeManager = context.sourceCode.scopeManager;

packages/eslint-plugin-svelte/src/rules/no-navigation-without-base.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ export default createRule('no-navigation-without-base', {
4444
replaceStateNotPrefixed:
4545
"Found a replaceState() call with a url that isn't prefixed with the base path."
4646
},
47-
type: 'suggestion'
47+
type: 'suggestion',
48+
conditions: [
49+
{
50+
svelteKitVersions: ['1.0.0-next', '1', '2']
51+
}
52+
]
4853
},
4954
create(context) {
5055
let basePathNames: Set<TSESTree.Identifier> = new Set<TSESTree.Identifier>();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelte": "^4"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelte": "^4"
3+
}

0 commit comments

Comments
 (0)