@@ -46,6 +46,21 @@ const eslint = new ESLint({
46
46
'mdx/code-block' : true ,
47
47
} ,
48
48
} ,
49
+ {
50
+ files : '**/eslint-plugin-svelte3/*.svelte' ,
51
+ plugins : [ 'svelte3' ] ,
52
+ processor : 'svelte3/svelte3' ,
53
+ } ,
54
+ {
55
+ files : '**/eslint-plugin-svelte3/*.named-blocks.svelte' ,
56
+ settings : {
57
+ 'svelte3/named-blocks' : true ,
58
+ } ,
59
+ } ,
60
+ {
61
+ files : '**/@ota-meshi/eslint-plugin-svelte/*.svelte' ,
62
+ extends : [ 'plugin:@ota-meshi/svelte/recommended' ] ,
63
+ } ,
49
64
] ,
50
65
} ,
51
66
useEslintrc : false ,
@@ -158,8 +173,8 @@ atGraphqlEslintRuleTester.run('@graphql-eslint/eslint-plugin', rule, {
158
173
] ,
159
174
} ) ;
160
175
161
- // eslint-plugin-graphql handles literal graphql files by tranforming graphql
162
- // code with a processor, instead of using a parser. Unfortunatly we cant
176
+ // eslint-plugin-graphql handles literal graphql files by transforming graphql
177
+ // code with a processor, instead of using a parser. Unfortunately we cant
163
178
// specify custom processors in a RuleTester, so instead we have write test code
164
179
// that is the result of eslint-plugin-graphql's processing - this is the
165
180
// ESLintPluginGraphQLFile tagged template literal. See
@@ -210,7 +225,7 @@ mdxRuleTester.run('eslint-plugin-mdx', rule, {
210
225
] ,
211
226
} ) ;
212
227
213
- runFixture ( 'mdx' , [
228
+ runFixture ( '*. mdx' , [
214
229
[
215
230
{
216
231
column : 33 ,
@@ -245,6 +260,43 @@ runFixture('mdx', [
245
260
] ,
246
261
] ) ;
247
262
263
+ runFixture ( '@ota-meshi/eslint-plugin-svelte/*.svelte' , [
264
+ [
265
+ {
266
+ column : 5 ,
267
+ endColumn : 13 ,
268
+ endLine : 2 ,
269
+ fix : {
270
+ range : [ 13 , 21 ] ,
271
+ text : 'name =' ,
272
+ } ,
273
+ line : 2 ,
274
+ message : 'Replace `·name·=·` with `name·=`' ,
275
+ messageId : 'replace' ,
276
+ nodeType : null ,
277
+ ruleId : 'prettier/prettier' ,
278
+ severity : 2 ,
279
+ } ,
280
+ {
281
+ column : 4 ,
282
+ endColumn : 7 ,
283
+ endLine : 5 ,
284
+ fix : {
285
+ range : [ 45 , 48 ] ,
286
+ text : '>' ,
287
+ } ,
288
+ line : 5 ,
289
+ message : 'Replace `·>·` with `>`' ,
290
+ messageId : 'replace' ,
291
+ nodeType : null ,
292
+ ruleId : 'prettier/prettier' ,
293
+ severity : 2 ,
294
+ } ,
295
+ ] ,
296
+ ] ) ;
297
+
298
+ runFixture ( 'eslint-plugin-svelte3/*.svelte' , [ [ ] , [ ] ] ) ;
299
+
248
300
// ------------------------------------------------------------------------------
249
301
// Helpers
250
302
// ------------------------------------------------------------------------------
@@ -288,12 +340,18 @@ function getPrettierRcJsFilename(dir, file = 'dummy.js') {
288
340
return path . resolve ( __dirname , `./prettierrc/${ dir } /${ file } ` ) ;
289
341
}
290
342
291
- async function runFixture ( name , asserts ) {
343
+ /**
344
+ *
345
+ * @param {string } pattern
346
+ * @param {import('eslint').Linter.LintMessage[] } asserts
347
+ * @returns {Promise<void> }
348
+ */
349
+ async function runFixture ( pattern , asserts ) {
292
350
try {
293
- const results = await eslint . lintFiles ( `test/fixtures/${ name } .*` ) ;
351
+ const results = await eslint . lintFiles ( [ `test/fixtures/${ pattern } ` ] ) ;
294
352
return assert . deepStrictEqual (
295
- asserts ,
296
353
results . map ( ( { messages } ) => messages ) ,
354
+ asserts ,
297
355
) ;
298
356
} catch ( err ) {
299
357
console . error ( err ) ;
0 commit comments