Skip to content

Commit 56b1c4b

Browse files
authored
Merge aws#5307 lint: use gitignore, enforce prettier rules
2 parents eae810b + 2d2c919 commit 56b1c4b

File tree

557 files changed

+2219
-2110
lines changed

Some content is hidden

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

557 files changed

+2219
-2110
lines changed

.eslintignore

Lines changed: 0 additions & 24 deletions
This file was deleted.

.eslintrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ module.exports = {
1818
'plugin:@typescript-eslint/eslint-recommended',
1919
'plugin:@typescript-eslint/recommended-requiring-type-checking',
2020
'plugin:@typescript-eslint/recommended',
21-
'prettier',
21+
// "Add this as the _last_ item in the extends array, so that eslint-config-prettier has the
22+
// opportunity to override other configs." https://github.com/prettier/eslint-plugin-prettier
23+
'plugin:prettier/recommended',
2224
],
2325
rules: {
2426
curly: 2, // Enforce braces on "if"/"for"/etc.

.gitignore

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Note: also used for `eslint --ignore-path`.
2+
13
out
24
dist
35
node_modules
@@ -27,15 +29,15 @@ packages/core/src/shared/telemetry/vscodeTelemetry.json
2729
.test-reports
2830

2931
# Auto generated type definitions
30-
packages/core/src/shared/telemetry/clienttelemetry.d.ts
31-
packages/core/src/codewhisperer/client/codewhispererclient.d.ts
32-
packages/core/src/codewhisperer/client/codewhispereruserclient.d.ts
33-
packages/core/src/amazonqFeatureDev/client/featuredevproxyclient.d.ts
34-
packages/core/src/auth/sso/oidcclientpkce.d.ts
32+
**/src/shared/telemetry/clienttelemetry.d.ts
33+
**/src/codewhisperer/client/codewhispererclient.d.ts
34+
**/src/codewhisperer/client/codewhispereruserclient.d.ts
35+
**/src/amazonqFeatureDev/client/featuredevproxyclient.d.ts
36+
**/src/auth/sso/oidcclientpkce.d.ts
3537

3638
# Generated by tests
37-
packages/core/src/testFixtures/**/bin
38-
packages/core/src/testFixtures/**/obj
39+
**/src/testFixtures/**/bin
40+
**/src/testFixtures/**/obj
3941

4042
# Generated by copyFiles.ts
4143
packages/*/LICENSE

package-lock.json

Lines changed: 77 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"singleQuote": true,
1717
"semi": false,
1818
"bracketSpacing": true,
19-
"arrowParens": "avoid",
19+
"arrowParens": "always",
2020
"endOfLine": "lf"
2121
},
2222
"scripts": {
@@ -32,10 +32,8 @@
3232
"package": "npm run package -w packages/toolkit -w packages/amazonq",
3333
"newChange": "echo 'Must specify subproject/workspace with -w packages/<subproject>' && false",
3434
"createRelease": "echo 'Must specify subproject/workspace with -w packages/<subproject>' && false",
35-
"format": "prettier --check plugins && npm run format -w packages/ --if-present",
36-
"formatfix": "prettier --write plugins && npm run formatfix -w packages/ --if-present",
37-
"lint": "npm run lint -w packages/ --if-present && npm run format",
38-
"lintfix": "eslint -c .eslintrc.js --fix --ext .ts packages plugins && npm run formatfix",
35+
"lint": "npm run lint -w packages/ --if-present",
36+
"lintfix": "eslint -c .eslintrc.js --ignore-path .gitignore --ignore-pattern '**/*.json' --ignore-pattern '**/*.gen.ts' --ignore-pattern '**/types/*.d.ts' --ignore-pattern '**/src/testFixtures/**' --ignore-pattern '**/resources/js/graphStateMachine.js' --fix --ext .ts packages plugins",
3937
"clean": "npm run clean -w packages/ -w plugins/",
4038
"reset": "npm run clean && ts-node ./scripts/clean.ts node_modules && npm install",
4139
"generateNonCodeFiles": "npm run generateNonCodeFiles -w packages/ --if-present"
@@ -55,6 +53,7 @@
5553
"eslint-config-prettier": "^9.1.0",
5654
"eslint-plugin-aws-toolkits": "file:plugins/eslint-plugin-aws-toolkits",
5755
"eslint-plugin-header": "^3.1.1",
56+
"eslint-plugin-prettier": "^5.1.3",
5857
"eslint-plugin-security-node": "^1.1.4",
5958
"eslint-plugin-unicorn": "^54.0.0",
6059
"husky": "^9.0.7",

packages/amazonq/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@
5454
"compile": "npm run clean && npm run buildScripts && webpack --mode development",
5555
"compileOnly": "tsc -p ./",
5656
"package": "ts-node ../../scripts/package.ts",
57-
"format": "prettier --ignore-path ../../.prettierignore --check src scripts",
58-
"formatfix": "prettier --ignore-path ../../.prettierignore --write src scripts",
59-
"lint": "echo 'Nothing to lint yet!'",
57+
"lint": "true",
6058
"watch": "npm run clean && npm run buildScripts && tsc -watch -p ./",
6159
"testCompile": "npm run clean && npm run buildScripts && npm run compileOnly",
6260
"test": "npm run testCompile && c8 ts-node ../core/scripts/test/test.ts dist/test/unit/index.js ../core/dist/src/testFixtures/workspaceFolder",

packages/amazonq/scripts/build/copyFiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface CopyTask {
2626
}
2727

2828
const tasks: CopyTask[] = [
29-
...['LICENSE', 'NOTICE'].map(f => {
29+
...['LICENSE', 'NOTICE'].map((f) => {
3030
return { target: path.join('../../', f), destination: path.join(projectRoot, f) }
3131
}),
3232

packages/amazonq/scripts/build/syncPackageJson.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function main() {
2525
const coreLibPackageJson = JSON.parse(fs.readFileSync(coreLibPackageJsonFile, { encoding: 'utf-8' }))
2626

2727
const coreSettings = coreLibPackageJson.contributes.configuration.properties
28-
Object.keys(coreSettings).forEach(key => {
28+
Object.keys(coreSettings).forEach((key) => {
2929
if (key.startsWith('amazonQ')) {
3030
packageJson.contributes.configuration.properties[key] = coreSettings[key]
3131
}

packages/amazonq/src/extensionCommon.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const amazonQContextPrefix = 'amazonq'
4444
*/
4545
export async function activateAmazonQCommon(context: vscode.ExtensionContext, isWeb: boolean) {
4646
initialize(context, isWeb)
47-
const homeDirLogs = await fs.init(context, homeDir => {
47+
const homeDirLogs = await fs.init(context, (homeDir) => {
4848
void messages.showViewLogsMessage(`Invalid home directory (check $HOME): "${homeDir}"`)
4949
})
5050
errors.init(fs.getUsername(), env.isAutomation())
@@ -73,12 +73,12 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
7373
} and older. Your AWS Toolkit was updated to version 3.0 or later.`,
7474
'Reload Now'
7575
)
76-
.then(async resp => {
76+
.then(async (resp) => {
7777
if (resp === 'Reload Now') {
7878
await vscode.commands.executeCommand('workbench.action.reloadWindow')
7979
}
8080
}),
81-
reason => {
81+
(reason) => {
8282
getLogger().error('workbench.extensions.installExtension failed: %O', reason)
8383
}
8484
)

packages/amazonq/test/e2e/amazonq/featureDev.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ describe('Amazon Q Feature Dev', function () {
7878

7979
function waitForButtons(buttons: FollowUpTypes[]) {
8080
return tab.waitForEvent(() => {
81-
return buttons.every(value => tab.hasButton(value))
81+
return buttons.every((value) => tab.hasButton(value))
8282
})
8383
}
8484

8585
async function waitForText(text: string) {
8686
await tab.waitForEvent(
8787
() => {
88-
return tab.getChatItems().some(chatItem => chatItem.body === text)
88+
return tab.getChatItems().some((chatItem) => chatItem.body === text)
8989
},
9090
{
9191
waitIntervalInMs: 250,

0 commit comments

Comments
 (0)