Skip to content

Commit

Permalink
chore: lint for test fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed May 8, 2024
1 parent 13235eb commit fa309b0
Show file tree
Hide file tree
Showing 16 changed files with 836 additions and 840 deletions.
6 changes: 6 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ export default antfu(
'antfu/top-level-function': 'off',
},
},
{
files: ['**/*.test.ts'],
rules: {
'antfu/indent-unindent': 'error',
},
},
)
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@
"eslint": "*"
},
"devDependencies": {
"@antfu/eslint-config": "^2.16.2",
"@antfu/eslint-config": "^2.17.0",
"@antfu/ni": "^0.21.12",
"@antfu/utils": "^0.7.7",
"@antfu/utils": "^0.7.8",
"@eslint/config-inspector": "^0.4.8",
"@types/eslint": "^8.56.10",
"@types/lodash.merge": "^4.6.9",
"@types/node": "^20.12.10",
"@types/node": "^20.12.11",
"@types/semver": "^7.5.8",
"@typescript-eslint/rule-tester": "^7.8.0",
"@typescript-eslint/typescript-estree": "^7.8.0",
Expand All @@ -95,7 +95,7 @@
"bumpp": "^9.4.1",
"eslint": "^9.2.0",
"eslint-define-config": "^2.1.0",
"eslint-vitest-rule-tester": "^0.3.0",
"eslint-vitest-rule-tester": "^0.3.2",
"esno": "^4.7.0",
"fast-glob": "^3.3.2",
"lint-staged": "^15.2.2",
Expand Down
392 changes: 127 additions & 265 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

44 changes: 26 additions & 18 deletions src/commands/inline-arrow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,54 @@ run(
// no arrow function
{
code: $`
///inline-arrow
const a = 1`,
///inline-arrow
const a = 1
`,
errors: ['command-error'],
},
// multi statement
{
code: $`
/// inline-arrow
export const foo = arg => {
const a = 1
return a
}`,
/// inline-arrow
export const foo = arg => {
const a = 1
return a
}
`,
errors: ['command-error'],
},
{
code: $`
/// inline-arrow
export const foo = <T = 1>(arg: Z): Bar => {
return arg
}`,
/// inline-arrow
export const foo = <T = 1>(arg: Z): Bar => {
return arg
}
`,
output: $`
export const foo = <T = 1>(arg: Z): Bar => arg`,
export const foo = <T = 1>(arg: Z): Bar => arg
`,
errors: ['command-fix'],
},
// no return statement
{
code: $`
///inline-arrow
const foo = () => {}`,
///inline-arrow
const foo = () => {}
`,
output: $`
const foo = () => undefined`,
const foo = () => undefined
`,
errors: ['command-fix'],
},
// without return argument
{
code: $`
// /ia
export default <T = 1>(arg: Z): Bar => { return }`,
// /ia
export default <T = 1>(arg: Z): Bar => { return }
`,
output: $`
export default <T = 1>(arg: Z): Bar => undefined`,
export default <T = 1>(arg: Z): Bar => undefined
`,
errors: ['command-fix'],
},
)
Loading

0 comments on commit fa309b0

Please sign in to comment.