-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve
svelte/valid-prop-names-in-kit-pages
and `svelte/no-e…
…xport-load-in-svelte-module-in-kit-pages` to use `svelte.config.js` data (#794) This PR improves the two rules to use `svelte.config.js` data provided by the parser. - `svelte/valid-prop-names-in-kit-pages` - `svelte/no-export-load-in-svelte-module-in-kit-pages`
- Loading branch information
Showing
19 changed files
with
237 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'eslint-plugin-svelte': minor | ||
--- | ||
|
||
feat: improve `svelte/valid-prop-names-in-kit-pages` to use `svelte.config.js` data from the parser. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'eslint-plugin-svelte': minor | ||
--- | ||
|
||
feat: improve `svelte/no-export-load-in-svelte-module-in-kit-pages` to use `svelte.config.js` data from the parser. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...-svelte-module-in-kit-pages/invalid/svelte-config-from-parser-options/+test01-errors.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- message: disallow exporting load functions in `*.svelte` module in SvelteKit | ||
page components. | ||
line: 2 | ||
column: 18 | ||
suggestions: null |
3 changes: 3 additions & 0 deletions
3
...svelte-module-in-kit-pages/invalid/svelte-config-from-parser-options/+test01-input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<script context="module"> | ||
export function load() {} | ||
</script> |
13 changes: 13 additions & 0 deletions
13
...load-in-svelte-module-in-kit-pages/invalid/svelte-config-from-parser-options/_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"languageOptions": { | ||
"parserOptions": { | ||
"svelteConfig": { | ||
"kit": { | ||
"files": { | ||
"routes": "tests/fixtures/rules/no-export-load-in-svelte-module-in-kit-pages/invalid/svelte-config-from-parser-options" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...es/no-export-load-in-svelte-module-in-kit-pages/invalid/svelte-config/+test01-errors.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- message: disallow exporting load functions in `*.svelte` module in SvelteKit | ||
page components. | ||
line: 2 | ||
column: 18 | ||
suggestions: null |
3 changes: 3 additions & 0 deletions
3
...s/no-export-load-in-svelte-module-in-kit-pages/invalid/svelte-config/+test01-input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<script context="module"> | ||
export function load() {} | ||
</script> |
8 changes: 8 additions & 0 deletions
8
...rules/no-export-load-in-svelte-module-in-kit-pages/invalid/svelte-config/svelte.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default { | ||
kit: { | ||
files: { | ||
routes: | ||
'tests/fixtures/rules/no-export-load-in-svelte-module-in-kit-pages/invalid/svelte-config' | ||
} | ||
} | ||
}; |
24 changes: 24 additions & 0 deletions
24
...id-prop-names-in-kit-pages/invalid/svelte-config-from-parser-options/+test001-errors.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 2 | ||
column: 13 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 3 | ||
column: 13 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 4 | ||
column: 15 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 4 | ||
column: 20 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 5 | ||
column: 21 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 5 | ||
column: 36 | ||
suggestions: null |
8 changes: 8 additions & 0 deletions
8
...d-prop-names-in-kit-pages/invalid/svelte-config-from-parser-options/+test001-input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script> | ||
export let foo; | ||
export let bar; | ||
export let { baz, qux } = data; | ||
export let { data: data2, errors: errors2 } = { data: {}, errors: {} }; | ||
</script> | ||
|
||
{foo}, {bar} |
13 changes: 13 additions & 0 deletions
13
...ules/valid-prop-names-in-kit-pages/invalid/svelte-config-from-parser-options/_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"languageOptions": { | ||
"parserOptions": { | ||
"svelteConfig": { | ||
"kit": { | ||
"files": { | ||
"routes": "tests/fixtures/rules/valid-prop-names-in-kit-pages/invalid/svelte-config-from-parser-options" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...s/fixtures/rules/valid-prop-names-in-kit-pages/invalid/svelte-config/+test001-errors.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 2 | ||
column: 13 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 3 | ||
column: 13 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 4 | ||
column: 15 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 4 | ||
column: 20 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 5 | ||
column: 21 | ||
suggestions: null | ||
- message: disallow props other than data or errors in SvelteKit page components. | ||
line: 5 | ||
column: 36 | ||
suggestions: null |
8 changes: 8 additions & 0 deletions
8
.../fixtures/rules/valid-prop-names-in-kit-pages/invalid/svelte-config/+test001-input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script> | ||
export let foo; | ||
export let bar; | ||
export let { baz, qux } = data; | ||
export let { data: data2, errors: errors2 } = { data: {}, errors: {} }; | ||
</script> | ||
|
||
{foo}, {bar} |
7 changes: 7 additions & 0 deletions
7
...tests/fixtures/rules/valid-prop-names-in-kit-pages/invalid/svelte-config/svelte.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default { | ||
kit: { | ||
files: { | ||
routes: 'tests/fixtures/rules/valid-prop-names-in-kit-pages/invalid/svelte-config' | ||
} | ||
} | ||
}; |