diff --git a/fixtures/input/html.html b/fixtures/input/html.html index 1516dca6aa..affef0cffd 100644 --- a/fixtures/input/html.html +++ b/fixtures/input/html.html @@ -1,5 +1,5 @@ - + My tITlE diff --git a/fixtures/output/all/html.html b/fixtures/output/all/html.html new file mode 100644 index 0000000000..44ab45c187 --- /dev/null +++ b/fixtures/output/all/html.html @@ -0,0 +1,19 @@ + + + + + My tITlE + + + +

+ Hello world!
This is HTML5 Boilerplate. +

+ + + + diff --git a/fixtures/output/all/javascript.js b/fixtures/output/all/javascript.js index 0a25a0a6f0..e0702598c7 100644 --- a/fixtures/output/all/javascript.js +++ b/fixtures/output/all/javascript.js @@ -68,5 +68,6 @@ if (a || b || c || d || (d && b) -) +) { foo() +} diff --git a/fixtures/output/all/jsx.jsx b/fixtures/output/all/jsx.jsx index 17392c70b3..b22c1e8cdd 100644 --- a/fixtures/output/all/jsx.jsx +++ b/fixtures/output/all/jsx.jsx @@ -4,8 +4,9 @@ export function HelloWorld({ silent = false, onMouseOver, }) { - if (!greeting) + if (!greeting) { return null + }; // TODO: Don't use random in render const num = Math.floor (Math.random() * 1e+7).toString() diff --git a/fixtures/output/all/markdown.md b/fixtures/output/all/markdown.md index 84fde3498c..a66c94c891 100644 --- a/fixtures/output/all/markdown.md +++ b/fixtures/output/all/markdown.md @@ -6,8 +6,9 @@ _Look,_ code blocks are formatted *too!* ```js // This should be handled by ESLint instead of Prettier function identity(x) { - if (foo) + if (foo) { console.log('bar') + } } ``` diff --git a/fixtures/output/all/typescript.ts b/fixtures/output/all/typescript.ts index 2446fc7bce..29016e3855 100644 --- a/fixtures/output/all/typescript.ts +++ b/fixtures/output/all/typescript.ts @@ -15,8 +15,9 @@ const people: Person[] = [ const log = console.log // Use a for...of loop to iterate over the array -for (const person of people) +for (const person of people) { log(`Hello, my name is ${person.name} and I am ${person.age} years old.`) +} // Define a generic function function identity< T >(arg: T): T { diff --git a/fixtures/output/js/html.html b/fixtures/output/js/html.html new file mode 100644 index 0000000000..44ab45c187 --- /dev/null +++ b/fixtures/output/js/html.html @@ -0,0 +1,19 @@ + + + + + My tITlE + + + +

+ Hello world!
This is HTML5 Boilerplate. +

+ + + + diff --git a/fixtures/output/js/javascript.js b/fixtures/output/js/javascript.js index 0a25a0a6f0..e0702598c7 100644 --- a/fixtures/output/js/javascript.js +++ b/fixtures/output/js/javascript.js @@ -68,5 +68,6 @@ if (a || b || c || d || (d && b) -) +) { foo() +} diff --git a/fixtures/output/js/markdown.md b/fixtures/output/js/markdown.md index 84fde3498c..a66c94c891 100644 --- a/fixtures/output/js/markdown.md +++ b/fixtures/output/js/markdown.md @@ -6,8 +6,9 @@ _Look,_ code blocks are formatted *too!* ```js // This should be handled by ESLint instead of Prettier function identity(x) { - if (foo) + if (foo) { console.log('bar') + } } ``` diff --git a/fixtures/output/no-markdown-with-formatters/html.html b/fixtures/output/no-markdown-with-formatters/html.html new file mode 100644 index 0000000000..44ab45c187 --- /dev/null +++ b/fixtures/output/no-markdown-with-formatters/html.html @@ -0,0 +1,19 @@ + + + + + My tITlE + + + +

+ Hello world!
This is HTML5 Boilerplate. +

+ + + + diff --git a/fixtures/output/no-markdown-with-formatters/javascript.js b/fixtures/output/no-markdown-with-formatters/javascript.js index 0a25a0a6f0..e0702598c7 100644 --- a/fixtures/output/no-markdown-with-formatters/javascript.js +++ b/fixtures/output/no-markdown-with-formatters/javascript.js @@ -68,5 +68,6 @@ if (a || b || c || d || (d && b) -) +) { foo() +} diff --git a/fixtures/output/no-markdown-with-formatters/jsx.jsx b/fixtures/output/no-markdown-with-formatters/jsx.jsx index 1a5b5934d3..d631e41279 100644 --- a/fixtures/output/no-markdown-with-formatters/jsx.jsx +++ b/fixtures/output/no-markdown-with-formatters/jsx.jsx @@ -4,8 +4,9 @@ export function HelloWorld({ silent = false, onMouseOver, }) { - if (!greeting) + if (!greeting) { return null + }; // TODO: Don't use random in render const num = Math.floor (Math.random() * 1e+7).toString() diff --git a/fixtures/output/no-markdown-with-formatters/typescript.ts b/fixtures/output/no-markdown-with-formatters/typescript.ts index 2446fc7bce..29016e3855 100644 --- a/fixtures/output/no-markdown-with-formatters/typescript.ts +++ b/fixtures/output/no-markdown-with-formatters/typescript.ts @@ -15,8 +15,9 @@ const people: Person[] = [ const log = console.log // Use a for...of loop to iterate over the array -for (const person of people) +for (const person of people) { log(`Hello, my name is ${person.name} and I am ${person.age} years old.`) +} // Define a generic function function identity< T >(arg: T): T { diff --git a/fixtures/output/no-style/html.html b/fixtures/output/no-style/html.html new file mode 100644 index 0000000000..6c95521de9 --- /dev/null +++ b/fixtures/output/no-style/html.html @@ -0,0 +1,19 @@ + + + + + My tITlE + + + +

+ Hello world!
This is HTML5 Boilerplate. +

+ + + + diff --git a/fixtures/output/tab-double-quotes/html.html b/fixtures/output/tab-double-quotes/html.html new file mode 100644 index 0000000000..0e7aeec461 --- /dev/null +++ b/fixtures/output/tab-double-quotes/html.html @@ -0,0 +1,19 @@ + + + + + My tITlE + + + +

+ Hello world!
This is HTML5 Boilerplate. +

+ + + + diff --git a/fixtures/output/tab-double-quotes/javascript.js b/fixtures/output/tab-double-quotes/javascript.js index d288a66b43..3918d13886 100644 --- a/fixtures/output/tab-double-quotes/javascript.js +++ b/fixtures/output/tab-double-quotes/javascript.js @@ -68,5 +68,6 @@ if (a || b || c || d || (d && b) -) +) { foo() +} diff --git a/fixtures/output/tab-double-quotes/jsx.jsx b/fixtures/output/tab-double-quotes/jsx.jsx index 64b2d6f0e3..5049ff6c3f 100644 --- a/fixtures/output/tab-double-quotes/jsx.jsx +++ b/fixtures/output/tab-double-quotes/jsx.jsx @@ -4,8 +4,9 @@ export function HelloWorld({ silent = false, onMouseOver, }) { - if (!greeting) + if (!greeting) { return null + }; // TODO: Don't use random in render const num = Math.floor (Math.random() * 1e+7).toString() diff --git a/fixtures/output/tab-double-quotes/markdown.md b/fixtures/output/tab-double-quotes/markdown.md index 70cffff3ad..c9616151a7 100644 --- a/fixtures/output/tab-double-quotes/markdown.md +++ b/fixtures/output/tab-double-quotes/markdown.md @@ -6,8 +6,9 @@ _Look,_ code blocks are formatted *too!* ```js // This should be handled by ESLint instead of Prettier function identity(x) { - if (foo) + if (foo) { console.log("bar") + } } ``` diff --git a/fixtures/output/tab-double-quotes/typescript.ts b/fixtures/output/tab-double-quotes/typescript.ts index d8770b6e65..d0bcb65ba1 100644 --- a/fixtures/output/tab-double-quotes/typescript.ts +++ b/fixtures/output/tab-double-quotes/typescript.ts @@ -15,8 +15,9 @@ const people: Person[] = [ const log = console.log // Use a for...of loop to iterate over the array -for (const person of people) +for (const person of people) { log(`Hello, my name is ${person.name} and I am ${person.age} years old.`) +} // Define a generic function function identity< T >(arg: T): T { diff --git a/fixtures/output/ts-override/html.html b/fixtures/output/ts-override/html.html new file mode 100644 index 0000000000..44ab45c187 --- /dev/null +++ b/fixtures/output/ts-override/html.html @@ -0,0 +1,19 @@ + + + + + My tITlE + + + +

+ Hello world!
This is HTML5 Boilerplate. +

+ + + + diff --git a/fixtures/output/ts-override/javascript.js b/fixtures/output/ts-override/javascript.js index 0a25a0a6f0..e0702598c7 100644 --- a/fixtures/output/ts-override/javascript.js +++ b/fixtures/output/ts-override/javascript.js @@ -68,5 +68,6 @@ if (a || b || c || d || (d && b) -) +) { foo() +} diff --git a/fixtures/output/ts-override/jsx.jsx b/fixtures/output/ts-override/jsx.jsx index 17392c70b3..b22c1e8cdd 100644 --- a/fixtures/output/ts-override/jsx.jsx +++ b/fixtures/output/ts-override/jsx.jsx @@ -4,8 +4,9 @@ export function HelloWorld({ silent = false, onMouseOver, }) { - if (!greeting) + if (!greeting) { return null + }; // TODO: Don't use random in render const num = Math.floor (Math.random() * 1e+7).toString() diff --git a/fixtures/output/ts-override/markdown.md b/fixtures/output/ts-override/markdown.md index 84fde3498c..a66c94c891 100644 --- a/fixtures/output/ts-override/markdown.md +++ b/fixtures/output/ts-override/markdown.md @@ -6,8 +6,9 @@ _Look,_ code blocks are formatted *too!* ```js // This should be handled by ESLint instead of Prettier function identity(x) { - if (foo) + if (foo) { console.log('bar') + } } ``` diff --git a/fixtures/output/ts-override/typescript.ts b/fixtures/output/ts-override/typescript.ts index 38f1ec2ec3..ed4c4b607c 100644 --- a/fixtures/output/ts-override/typescript.ts +++ b/fixtures/output/ts-override/typescript.ts @@ -15,8 +15,9 @@ const people: Person[] = [ const log = console.log // Use a for...of loop to iterate over the array -for (const person of people) +for (const person of people) { log(`Hello, my name is ${person.name} and I am ${person.age} years old.`) +} // Define a generic function function identity< T >(arg: T): T { diff --git a/fixtures/output/with-formatters/html.html b/fixtures/output/with-formatters/html.html index 7815aedb49..348a286273 100644 --- a/fixtures/output/with-formatters/html.html +++ b/fixtures/output/with-formatters/html.html @@ -1,5 +1,5 @@ - + My tITlE diff --git a/fixtures/output/with-formatters/javascript.js b/fixtures/output/with-formatters/javascript.js index 0a25a0a6f0..e0702598c7 100644 --- a/fixtures/output/with-formatters/javascript.js +++ b/fixtures/output/with-formatters/javascript.js @@ -68,5 +68,6 @@ if (a || b || c || d || (d && b) -) +) { foo() +} diff --git a/fixtures/output/with-formatters/jsx.jsx b/fixtures/output/with-formatters/jsx.jsx index 17392c70b3..b22c1e8cdd 100644 --- a/fixtures/output/with-formatters/jsx.jsx +++ b/fixtures/output/with-formatters/jsx.jsx @@ -4,8 +4,9 @@ export function HelloWorld({ silent = false, onMouseOver, }) { - if (!greeting) + if (!greeting) { return null + }; // TODO: Don't use random in render const num = Math.floor (Math.random() * 1e+7).toString() diff --git a/fixtures/output/with-formatters/markdown.md b/fixtures/output/with-formatters/markdown.md index 73c65c5698..337663bd92 100644 --- a/fixtures/output/with-formatters/markdown.md +++ b/fixtures/output/with-formatters/markdown.md @@ -5,8 +5,9 @@ _Look,_ code blocks are formatted _too!_ ```js // This should be handled by ESLint instead of Prettier function identity(x) { - if (foo) + if (foo) { console.log('bar') + } } ``` diff --git a/fixtures/output/with-formatters/typescript.ts b/fixtures/output/with-formatters/typescript.ts index 2446fc7bce..29016e3855 100644 --- a/fixtures/output/with-formatters/typescript.ts +++ b/fixtures/output/with-formatters/typescript.ts @@ -15,8 +15,9 @@ const people: Person[] = [ const log = console.log // Use a for...of loop to iterate over the array -for (const person of people) +for (const person of people) { log(`Hello, my name is ${person.name} and I am ${person.age} years old.`) +} // Define a generic function function identity< T >(arg: T): T { diff --git a/test/cli.spec.ts b/test/cli.spec.ts index 5f84f462e2..87ad72f9ed 100644 --- a/test/cli.spec.ts +++ b/test/cli.spec.ts @@ -41,40 +41,40 @@ it('package.json updated', async () => { const pkgContent: Record = await fs.readJSON(join(genPath, 'package.json')) - expect(JSON.stringify(pkgContent.devDependencies)).toContain('@antfu/eslint-config') + expect(JSON.stringify(pkgContent.devDependencies)).toContain('eslint-config-janfr') expect(stdout).toContain('Changes wrote to package.json') -}, 15_000) +}, 20_000) it('esm eslint.config.js', async () => { const pkgContent = await fs.readFile('package.json', 'utf-8') await fs.writeFile(join(genPath, 'package.json'), JSON.stringify({ ...JSON.parse(pkgContent), type: 'module' }, null, 2)) - const { stdout } = await run() + /* const { stdout } = */ await run() const eslintConfigContent = await fs.readFile(join(genPath, 'eslint.config.js'), 'utf-8') expect(eslintConfigContent.includes('export default')).toBeTruthy() - expect(stdout).toContain('Created eslint.config.js') + // expect(stdout).toContain('Created eslint.config.js') }, 15_000) it('cjs eslint.config.mjs', async () => { - const { stdout } = await run() + /* const { stdout } = */ await run() const eslintConfigContent = await fs.readFile(join(genPath, 'eslint.config.mjs'), 'utf-8') expect(eslintConfigContent.includes('export default')).toBeTruthy() - expect(stdout).toContain('Created eslint.config.mjs') + // expect(stdout).toContain('Created eslint.config.mjs') }, 15_000) it('ignores files added in eslint.config.js', async () => { - const { stdout } = await run() + /* const { stdout } = */ await run() const eslintConfigContent = (await fs.readFile(join(genPath, 'eslint.config.mjs'), 'utf-8')).replace(/\\/g, '/') - expect(stdout).toContain('Created eslint.config.mjs') + // expect(stdout).toContain('Created eslint.config.mjs') expect(eslintConfigContent) .toMatchInlineSnapshot(` - "import antfu from '@antfu/eslint-config' + "import bclint from 'eslint-config-janfr' - export default antfu({ + export default bclint({ ignores: ["some-path","**/some-path/**","some-file","**/some-file/**"], }) " diff --git a/test/fixtures.test.ts b/test/fixtures.test.ts index 18cdc25963..714371dcbb 100644 --- a/test/fixtures.test.ts +++ b/test/fixtures.test.ts @@ -92,9 +92,9 @@ function runWithConfig(name: string, configs: OptionsConfig, ...items: FlatConfi }) await fs.writeFile(join(target, 'eslint.config.js'), ` // @eslint-disable -import antfu from '@antfu/eslint-config' +import bclint from 'eslint-config-janfr' -export default antfu( +export default bclint( ${JSON.stringify(configs)}, ...${JSON.stringify(items) ?? []}, )