77 functions ,
88 imports ,
99 object ,
10- type AstKinds ,
1110 type AstTypes
1211} from '@sveltejs/cli-core/js' ;
1312import { parseJson , parseScript } from '@sveltejs/cli-core/parsers' ;
@@ -54,14 +53,12 @@ export default defineAddon({
5453 sv . file ( 'eslint.config.js' , ( content ) => {
5554 const { ast, generateCode } = parseScript ( content ) ;
5655
57- const eslintConfigs : Array <
58- AstKinds . ExpressionKind | AstTypes . SpreadElement | AstTypes . ObjectExpression
59- > = [ ] ;
56+ const eslintConfigs : Array < AstTypes . Expression | AstTypes . SpreadElement > = [ ] ;
6057
6158 imports . addDefault ( ast , './svelte.config.js' , 'svelteConfig' ) ;
6259
6360 const gitIgnorePathStatement = common . statementFromString (
64- ' \nconst gitignorePath = fileURLToPath(new URL(" ./.gitignore" , import.meta.url));'
61+ " \nconst gitignorePath = fileURLToPath(new URL(' ./.gitignore' , import.meta.url));"
6562 ) ;
6663 common . addStatement ( ast , gitIgnorePathStatement ) ;
6764
@@ -90,16 +87,19 @@ export default defineAddon({
9087 '"no-undef"' : off
9188 } ) ;
9289
93- if ( rules . properties [ 0 ] . type !== 'ObjectProperty ' ) {
94- throw new Error ( 'rules.properties[0].type !== "ObjectProperty "' ) ;
90+ if ( rules . properties [ 0 ] . type !== 'Property ' ) {
91+ throw new Error ( 'rules.properties[0].type !== "Property "' ) ;
9592 }
96- rules . properties [ 0 ] . key . comments = [
93+ rules . properties [ 0 ] . key . leadingComments = [
9794 {
98- type : 'Block ' ,
95+ type : 'Line ' ,
9996 value :
100- '*\n * typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.\n * see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors\n ' ,
101- leading : true ,
102- trailing : false
97+ ' typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.'
98+ } ,
99+ {
100+ type : 'Line' ,
101+ value :
102+ ' see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors'
103103 }
104104 ] ;
105105
@@ -114,8 +114,8 @@ export default defineAddon({
114114
115115 if ( typescript ) {
116116 const svelteTSParserConfig = object . create ( {
117- files : common . expressionFromString ( '[" **/*.svelte", " **/*.svelte.ts", " **/*.svelte.js"]' ) ,
118- ignores : common . expressionFromString ( '[" eslint.config.js", " svelte.config.js"]' ) ,
117+ files : common . expressionFromString ( "[' **/*.svelte', ' **/*.svelte.ts', ' **/*.svelte.js']" ) ,
118+ ignores : common . expressionFromString ( "[' eslint.config.js', ' svelte.config.js']" ) ,
119119 languageOptions : object . create ( {
120120 parserOptions : object . create ( {
121121 projectService : common . expressionFromString ( 'true' ) ,
@@ -128,7 +128,7 @@ export default defineAddon({
128128 eslintConfigs . push ( svelteTSParserConfig ) ;
129129 } else {
130130 const svelteTSParserConfig = object . create ( {
131- files : common . expressionFromString ( '[" **/*.svelte", " **/*.svelte.js"]' ) ,
131+ files : common . expressionFromString ( "[' **/*.svelte', ' **/*.svelte.js']" ) ,
132132 languageOptions : object . create ( {
133133 parserOptions : object . create ( {
134134 svelteConfig : common . expressionFromString ( 'svelteConfig' )
0 commit comments