@@ -46,6 +46,21 @@ const eslint = new ESLint({
4646 'mdx/code-block' : true ,
4747 } ,
4848 } ,
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+ } ,
4964 ] ,
5065 } ,
5166 useEslintrc : false ,
@@ -158,8 +173,8 @@ atGraphqlEslintRuleTester.run('@graphql-eslint/eslint-plugin', rule, {
158173 ] ,
159174} ) ;
160175
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
163178// specify custom processors in a RuleTester, so instead we have write test code
164179// that is the result of eslint-plugin-graphql's processing - this is the
165180// ESLintPluginGraphQLFile tagged template literal. See
@@ -210,7 +225,7 @@ mdxRuleTester.run('eslint-plugin-mdx', rule, {
210225 ] ,
211226} ) ;
212227
213- runFixture ( 'mdx' , [
228+ runFixture ( '*. mdx' , [
214229 [
215230 {
216231 column : 33 ,
@@ -245,6 +260,43 @@ runFixture('mdx', [
245260 ] ,
246261] ) ;
247262
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+
248300// ------------------------------------------------------------------------------
249301// Helpers
250302// ------------------------------------------------------------------------------
@@ -288,12 +340,18 @@ function getPrettierRcJsFilename(dir, file = 'dummy.js') {
288340 return path . resolve ( __dirname , `./prettierrc/${ dir } /${ file } ` ) ;
289341}
290342
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 ) {
292350 try {
293- const results = await eslint . lintFiles ( `test/fixtures/${ name } .*` ) ;
351+ const results = await eslint . lintFiles ( [ `test/fixtures/${ pattern } ` ] ) ;
294352 return assert . deepStrictEqual (
295- asserts ,
296353 results . map ( ( { messages } ) => messages ) ,
354+ asserts ,
297355 ) ;
298356 } catch ( err ) {
299357 console . error ( err ) ;
0 commit comments