Skip to content

Commit

Permalink
Fix: standardized and consistent linting strategy across Lerna targets (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
saragerion authored Sep 29, 2022
1 parent 237b99f commit f25f7bf
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lerna-lint
npm run lerna-lint-fix
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lerna-lint
npm run lerna-lint-fix
npm run test
2 changes: 2 additions & 0 deletions examples/cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"build": "tsc --skipLibCheck",
"watch": "tsc -w",
"test": "npm run test:unit",
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
"lint-fix": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"package": "echo 'Not applicable'",
"package-bundle": "echo 'Not applicable'",
"test:unit": "npm run build && jest",
Expand Down
2 changes: 2 additions & 0 deletions examples/sam/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"scripts": {
"build": "sam build --beta-features",
"test": "npm run test:unit",
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
"lint-fix": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"package": "echo 'Not applicable'",
"package-bundle": "echo 'Not applicable'",
"test:unit": "npm run build && jest",
Expand Down
2 changes: 2 additions & 0 deletions layer-publisher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"test": "npm run test:unit",
"cdk": "cdk",
"package": "echo 'Not applicable'",
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
"lint-fix": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"test:unit": "if-node-version '>12' jest --testPathPattern=unit -u",
"test:e2e": "if-node-version '>12' jest --testPathPattern=e2e"
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"lerna-package": "lerna exec -- npm run package",
"lerna-package-bundle": "lerna exec -- npm run package-bundle",
"lerna-build": "lerna exec -- tsc",
"lerna-lint": "lerna exec -- eslint \"./{src,tests}/**/*.ts ./src/*.ts\"",
"lerna-format": "lerna exec -- eslint --fix \"./{src,tests}/**/*.ts ./src/*.ts\"",
"lerna-lint": "lerna exec -- npm run lint",
"lerna-lint-fix": "lerna exec -- npm run lint-fix",
"lerna-prepare": "lerna exec -- npm run build",
"lerna-prepublishOnly": "lerna exec -- npm test && lerna exec -- npm run lint",
"lerna-preversion": "lerna exec -- npm run lint",
Expand Down
4 changes: 2 additions & 2 deletions packages/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"test:e2e": "echo 'Not Applicable'",
"watch": "jest --watch",
"build": "tsc",
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
"package-bundle": "../../package-bundler.sh commons-bundle ./dist",
"prepare": "npm run build",
Expand Down
4 changes: 2 additions & 2 deletions packages/idempotency/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test:e2e": "jest --group=e2e",
"watch": "jest --watch --group=unit",
"build": "tsc",
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
"package-bundle": "../../package-bundler.sh logger-bundle ./dist",
"prepare": "npm run build",
Expand Down
4 changes: 2 additions & 2 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test:e2e": "jest --group=e2e",
"watch": "jest --watch --group=unit",
"build": "tsc",
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
"package-bundle": "../../package-bundler.sh logger-bundle ./dist",
"prepare": "npm run build",
Expand Down
4 changes: 2 additions & 2 deletions packages/metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test:e2e": "jest --group=e2e",
"watch": "jest --group=unit --watch ",
"build": "tsc",
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
"package-bundle": "../../package-bundler.sh metrics-bundle ./dist",
"prepare": "npm run build",
Expand Down
6 changes: 3 additions & 3 deletions packages/metrics/tests/unit/middleware/middy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('Middy middleware', () => {
],
},
service: 'orders',
successfulBooking: [2, 1],
successfulBooking: [ 2, 1 ],
})
);
});
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('Middy middleware', () => {
CloudWatchMetrics: [
{
Namespace: 'serverlessAirline',
Dimensions: [['environment', 'aws_region', 'service', 'function_name']],
Dimensions: [[ 'environment', 'aws_region', 'service', 'function_name' ]],
Metrics: [{ Name: 'ColdStart', Unit: 'Count' }],
},
],
Expand All @@ -267,7 +267,7 @@ describe('Middy middleware', () => {
CloudWatchMetrics: [
{
Namespace: 'serverlessAirline',
Dimensions: [['environment', 'aws_region', 'service']],
Dimensions: [[ 'environment', 'aws_region', 'service' ]],
Metrics: [{ Name: 'successfulBooking', Unit: 'Count' }],
},
],
Expand Down
4 changes: 2 additions & 2 deletions packages/tracer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test:e2e": "jest --group=e2e",
"watch": "jest --watch",
"build": "tsc",
"lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests",
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern src tests",
"lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern src tests",
"prepare": "npm run build",
"prepublishOnly": "npm test && npm run lint",
"preversion": "npm run lint",
Expand Down

0 comments on commit f25f7bf

Please sign in to comment.