Skip to content

Commit

Permalink
feat(ts/lines-around-comment): add missing afterHashbangComment in …
Browse files Browse the repository at this point in the history
…schema, fix #75 (#161)
  • Loading branch information
antfu authored Nov 17, 2023
1 parent b346087 commit 391335b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1049,5 +1049,14 @@ interface A {
],
errors: [{ messageId: 'after', type: AST_TOKEN_TYPES.Line, line: 2 }],
},

// Hashbang comment
{
code: '#!foo\nvar a = 1;',
output: '#!foo\n\nvar a = 1;',
options: [{ afterHashbangComment: true }],
// @ts-expect-error -- Shebang is not in the type
errors: [{ messageId: 'after', type: 'Shebang' }],
},
],
})
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export default createRule<RuleOptions, MessageIds>({
applyDefaultIgnorePatterns: {
type: 'boolean',
},
afterHashbangComment: {
type: 'boolean',
},
},
additionalProperties: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface Schema0 {
allowModuleEnd?: boolean
ignorePattern?: string
applyDefaultIgnorePatterns?: boolean
afterHashbangComment?: boolean
}

export type RuleOptions = [Schema0?]
Expand Down

0 comments on commit 391335b

Please sign in to comment.