Skip to content

Commit f25f7bf

Browse files
authored
Fix: standardized and consistent linting strategy across Lerna targets (#1105)
* fix: lerna format standardized for all lerna packages + examples * chore: remove --fix to lint command, rename lerna format to lint-fix * chore: run lerna lint fix on commit & push
1 parent 237b99f commit f25f7bf

File tree

12 files changed

+23
-17
lines changed

12 files changed

+23
-17
lines changed

Diff for: .husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npm run lerna-lint
4+
npm run lerna-lint-fix

Diff for: .husky/pre-push

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npm run lerna-lint
4+
npm run lerna-lint-fix
55
npm run test

Diff for: examples/cdk/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"build": "tsc --skipLibCheck",
1515
"watch": "tsc -w",
1616
"test": "npm run test:unit",
17+
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
18+
"lint-fix": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
1719
"package": "echo 'Not applicable'",
1820
"package-bundle": "echo 'Not applicable'",
1921
"test:unit": "npm run build && jest",

Diff for: examples/sam/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"scripts": {
1111
"build": "sam build --beta-features",
1212
"test": "npm run test:unit",
13+
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
14+
"lint-fix": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
1315
"package": "echo 'Not applicable'",
1416
"package-bundle": "echo 'Not applicable'",
1517
"test:unit": "npm run build && jest",

Diff for: layer-publisher/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"test": "npm run test:unit",
1111
"cdk": "cdk",
1212
"package": "echo 'Not applicable'",
13+
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
14+
"lint-fix": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
1315
"test:unit": "if-node-version '>12' jest --testPathPattern=unit -u",
1416
"test:e2e": "if-node-version '>12' jest --testPathPattern=e2e"
1517
},

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"lerna-package": "lerna exec -- npm run package",
2323
"lerna-package-bundle": "lerna exec -- npm run package-bundle",
2424
"lerna-build": "lerna exec -- tsc",
25-
"lerna-lint": "lerna exec -- eslint \"./{src,tests}/**/*.ts ./src/*.ts\"",
26-
"lerna-format": "lerna exec -- eslint --fix \"./{src,tests}/**/*.ts ./src/*.ts\"",
25+
"lerna-lint": "lerna exec -- npm run lint",
26+
"lerna-lint-fix": "lerna exec -- npm run lint-fix",
2727
"lerna-prepare": "lerna exec -- npm run build",
2828
"lerna-prepublishOnly": "lerna exec -- npm test && lerna exec -- npm run lint",
2929
"lerna-preversion": "lerna exec -- npm run lint",

Diff for: packages/commons/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"test:e2e": "echo 'Not Applicable'",
1717
"watch": "jest --watch",
1818
"build": "tsc",
19-
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
20-
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
19+
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
20+
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
2121
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
2222
"package-bundle": "../../package-bundler.sh commons-bundle ./dist",
2323
"prepare": "npm run build",

Diff for: packages/idempotency/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"test:e2e": "jest --group=e2e",
2020
"watch": "jest --watch --group=unit",
2121
"build": "tsc",
22-
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
23-
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
22+
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
23+
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
2424
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
2525
"package-bundle": "../../package-bundler.sh logger-bundle ./dist",
2626
"prepare": "npm run build",

Diff for: packages/logger/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"test:e2e": "jest --group=e2e",
2020
"watch": "jest --watch --group=unit",
2121
"build": "tsc",
22-
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
23-
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
22+
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
23+
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
2424
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
2525
"package-bundle": "../../package-bundler.sh logger-bundle ./dist",
2626
"prepare": "npm run build",

Diff for: packages/metrics/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"test:e2e": "jest --group=e2e",
2020
"watch": "jest --group=unit --watch ",
2121
"build": "tsc",
22-
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
23-
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
22+
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
23+
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
2424
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
2525
"package-bundle": "../../package-bundler.sh metrics-bundle ./dist",
2626
"prepare": "npm run build",

Diff for: packages/metrics/tests/unit/middleware/middy.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe('Middy middleware', () => {
216216
],
217217
},
218218
service: 'orders',
219-
successfulBooking: [2, 1],
219+
successfulBooking: [ 2, 1 ],
220220
})
221221
);
222222
});
@@ -247,7 +247,7 @@ describe('Middy middleware', () => {
247247
CloudWatchMetrics: [
248248
{
249249
Namespace: 'serverlessAirline',
250-
Dimensions: [['environment', 'aws_region', 'service', 'function_name']],
250+
Dimensions: [[ 'environment', 'aws_region', 'service', 'function_name' ]],
251251
Metrics: [{ Name: 'ColdStart', Unit: 'Count' }],
252252
},
253253
],
@@ -267,7 +267,7 @@ describe('Middy middleware', () => {
267267
CloudWatchMetrics: [
268268
{
269269
Namespace: 'serverlessAirline',
270-
Dimensions: [['environment', 'aws_region', 'service']],
270+
Dimensions: [[ 'environment', 'aws_region', 'service' ]],
271271
Metrics: [{ Name: 'successfulBooking', Unit: 'Count' }],
272272
},
273273
],

Diff for: packages/tracer/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"test:e2e": "jest --group=e2e",
2020
"watch": "jest --watch",
2121
"build": "tsc",
22-
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
23-
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
22+
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
23+
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
2424
"prepare": "npm run build",
2525
"prepublishOnly": "npm test && npm run lint",
2626
"preversion": "npm run lint",

0 commit comments

Comments
 (0)