Skip to content

Commit 112a762

Browse files
committed
ci: require space at start of // comment
Problem: Inconsistent comment style. Solution: Add a lint rule.
1 parent 50ccef5 commit 112a762

File tree

69 files changed

+356
-131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+356
-131
lines changed

.eslintrc.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
mocha: true,
1313
es2024: true,
1414
},
15-
plugins: ['@typescript-eslint', 'unicorn', 'header', 'security-node', 'aws-toolkits'],
15+
plugins: ['@typescript-eslint', '@stylistic', 'unicorn', 'header', 'security-node', 'aws-toolkits'],
1616
extends: [
1717
'eslint:recommended',
1818
'plugin:@typescript-eslint/eslint-recommended',
@@ -113,6 +113,20 @@ module.exports = {
113113
'no-constant-condition': ['error', { checkLoops: false }],
114114
'no-empty': 'off',
115115

116+
// https://eslint.style/rules/default/spaced-comment
117+
// Require space after // comment.
118+
'@stylistic/spaced-comment': [
119+
'error',
120+
'always',
121+
{
122+
block: {
123+
markers: ['!'], // Allow the /*!…*/ license header.
124+
// exceptions: ['*'],
125+
// balanced: true
126+
},
127+
},
128+
],
129+
116130
// Rules from https://github.com/sindresorhus/eslint-plugin-unicorn
117131
// TODO: 'unicorn/no-useless-promise-resolve-reject': 'error',
118132
// TODO: 'unicorn/prefer-at': 'error',

package-lock.json

Lines changed: 211 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"devDependencies": {
4242
"@aws-toolkits/telemetry": "^1.0.284",
4343
"@playwright/browser-chromium": "^1.43.1",
44+
"@stylistic/eslint-plugin": "^2.11.0",
4445
"@types/he": "^1.2.3",
4546
"@types/vscode": "^1.68.0",
4647
"@types/vscode-webview": "^1.57.1",

packages/amazonq/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
5353
errors.init(fs.getUsername(), env.isAutomation())
5454
await initializeComputeRegion()
5555

56-
globals.contextPrefix = 'amazonq.' //todo: disconnect from above line
56+
globals.contextPrefix = 'amazonq.' // todo: disconnect from above line
5757

5858
// Avoid activation if older toolkit is installed
5959
// Amazon Q is only compatible with AWS Toolkit >= 3.0.0

packages/core/resources/js/graphStateMachine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ zoomoutBtn.addEventListener('click', () => {
108108

109109
// Message passing from extension to webview.
110110
// Capture state machine definition
111-
window.addEventListener('message', event => {
111+
window.addEventListener('message', (event) => {
112112
// event.data is object passed in from postMessage from vscode
113113
const message = event.data
114114
switch (message.command) {

packages/core/src/amazonq/lsp/lspController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ export class LspController {
360360
})
361361
}
362362
} catch (error) {
363-
//TODO: use telemetry.run()
363+
// TODO: use telemetry.run()
364364
getLogger().error(`LspController: Failed to build index of project`)
365365
telemetry.amazonq_indexWorkspace.emit({
366366
duration: performance.now() - start,

packages/core/src/amazonq/webview/ui/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const createMynahUI = (
4343
let mynahUI: MynahUI
4444
// eslint-disable-next-line prefer-const
4545
let connector: Connector
46-
//Store the mapping between messageId and messageUserIntent for amazonq_interactWithMessage telemetry
46+
// Store the mapping between messageId and messageUserIntent for amazonq_interactWithMessage telemetry
4747
const responseMetadata = new Map<string, string[]>()
4848

4949
window.addEventListener('error', (e) => {

packages/core/src/awsService/accessanalyzer/vue/iamPolicyChecks.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ export class IamPolicyChecksWebview extends VueWebview {
588588
})
589589
} catch (err: any) {
590590
if (err.status === 2) {
591-
//CLI responds with a status code of 2 when findings are discovered
591+
// CLI responds with a status code of 2 when findings are discovered
592592
const findingsCount = this.handleValidatePolicyCliResponse(err.stdout.toString())
593593
span.record({
594594
findingsCount: findingsCount,
@@ -652,7 +652,7 @@ export class IamPolicyChecksWebview extends VueWebview {
652652
})
653653
} catch (err: any) {
654654
if (err.status === 2) {
655-
//CLI responds with a status code of 2 when findings are discovered
655+
// CLI responds with a status code of 2 when findings are discovered
656656
const findingsCount = this.handleCustomPolicyChecksCliResponse(err.stdout.toString())
657657
span.record({
658658
findingsCount: findingsCount,
@@ -752,7 +752,7 @@ export async function renderIamPolicyChecks(context: ExtContext): Promise<VueWeb
752752
const logger: Logger = getLogger()
753753
try {
754754
const client = new AccessAnalyzer({ region: context.regionProvider.defaultRegionId })
755-
//Read from settings to auto-fill some inputs
755+
// Read from settings to auto-fill some inputs
756756
const checkNoNewAccessFilePath: string = vscode.workspace
757757
.getConfiguration()
758758
.get(IamPolicyChecksConstants.CheckNoNewAccessFilePathSetting)!
@@ -827,7 +827,7 @@ export async function _readCustomChecksFile(input: string): Promise<string> {
827827
}
828828
}
829829

830-
//Check if Cfn and Tf tools are installed
830+
// Check if Cfn and Tf tools are installed
831831
export function arePythonToolsInstalled(): boolean {
832832
const logger: Logger = getLogger()
833833
let cfnToolInstalled = true

packages/core/src/awsService/cloudWatchLogs/timeFilterSubmenu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class TimeFilterSubmenu extends Prompter<TimeFilterResponse> {
3838

3939
private get recentTimeItems(): DataQuickPickItem<number>[] {
4040
const options: DataQuickPickItem<number>[] = []
41-
//appromixate 31 days as month length (better to overshoot)
41+
// appromixate 31 days as month length (better to overshoot)
4242
options.push({
4343
label: 'All time',
4444
data: 0,

packages/core/src/awsService/iot/commands/attachCertificate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export async function attachCertificateCommand(node: IotThingNode, promptFun = p
4646

4747
getLogger().debug('Attached certificate %O', cert.certificateId)
4848

49-
//Refresh the Thing node
49+
// Refresh the Thing node
5050
await node.refreshNode()
5151
}
5252

0 commit comments

Comments
 (0)