-
-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support autofix in gts files #1853
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ function initESLint(options) { | |
plugins: ['ember'], | ||
extends: ['plugin:ember/recommended'], | ||
rules: { | ||
quotes: ['error', 'single'], | ||
semi: ['error', 'always'], | ||
'object-curly-spacing': ['error', 'always'], | ||
'lines-between-class-members': 'error', | ||
|
@@ -173,7 +174,7 @@ const invalid = [ | |
import Component from '@glimmer/component'; | ||
|
||
export default class MyComponent extends Component { | ||
foo = "bar"; | ||
foo = 'bar'; | ||
<template>"hi"</template> | ||
} | ||
`, | ||
|
@@ -193,7 +194,7 @@ const invalid = [ | |
import Component from '@glimmer/component'; | ||
|
||
export default class MyComponent extends Component { | ||
foo = "bar"; | ||
foo = 'bar'; | ||
<template>"hi" | ||
</template> | ||
} | ||
|
@@ -208,6 +209,36 @@ const invalid = [ | |
}, | ||
], | ||
}, | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a way to add the fixed output to this test? is that worth it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean the "file content" after auto fix? Not sure if that's worth it. That would just test eslint auto fix capability... Just need to be sure that the fix range is correct. |
||
filename: 'my-component.gjs', | ||
code: ` | ||
import Component from "@glimmer/component"; | ||
export default class MyComponent extends Component { | ||
foo = 'bar'; | ||
<template>"hi" | ||
</template> | ||
} | ||
`, | ||
errors: [ | ||
{ | ||
message: 'Strings must use singlequote.', | ||
line: 2, | ||
endLine: 2, | ||
endColumn: 49, | ||
column: 29, | ||
fix: { | ||
range: [29, 49], | ||
}, | ||
}, | ||
{ | ||
message: 'Expected blank line between class members.', | ||
line: 5, | ||
endLine: 6, | ||
column: 9, | ||
endColumn: 20, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
describe('template-vars', () => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add any high-level comment to provide some context about our support for autofixing and how it works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done