Skip to content

Commit 5d08b79

Browse files
authored
feat(scripts): use lint-staged to format (#865)
1 parent af00944 commit 5d08b79

File tree

6 files changed

+306
-45
lines changed

6 files changed

+306
-45
lines changed

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
. "$(dirname "$0")/_/husky.sh"
33

44
./scripts/husky/pre-commit.js
5-
./scripts/husky/format-generators.js
5+
yarn lint-staged

.lintstagedrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"generators/**/*.java": "docker exec -t dev yarn cli format java generators",
3+
".github/**/*.yml": "yarn github-actions:lint --fix",
4+
"*.json": "yarn fix:json",
5+
"scripts/**/*.(js|ts)": "yarn scripts:lint --fix"
6+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
"docker:build": "./scripts/docker/build.sh",
1717
"docker:clean": "docker stop dev; docker rm -f dev; docker image rm -f api-clients-automation",
1818
"docker:mount": "./scripts/docker/mount.sh",
19-
"docker:no-tty": "docker exec -t dev yarn cli $*",
2019
"docker:setup": "yarn docker:clean && yarn docker:build && yarn docker:mount",
2120
"fix:json": "eslint --ext=json . --fix",
2221
"github-actions:lint": "eslint --ext=yml .github/",
2322
"postinstall": "husky install && yarn workspace eslint-plugin-automation-custom build",
2423
"playground:browser": "yarn workspace javascript-browser-playground start",
2524
"release": "yarn workspace scripts createReleasePR",
26-
"scripts:lint": "eslint --ext=ts scripts/",
25+
"scripts:lint": "eslint --ext=ts,js scripts/",
2726
"scripts:test": "yarn workspace scripts test",
2827
"specs:fix": "eslint --ext=yml specs/$0 --fix",
2928
"specs:lint": "eslint --ext=yml specs/$0",
@@ -52,6 +51,7 @@
5251
"eslint-plugin-yml": "1.0.0",
5352
"husky": "8.0.1",
5453
"json": "11.0.0",
54+
"lint-staged": "13.0.3",
5555
"mustache": "4.2.0",
5656
"prettier": "2.7.1",
5757
"prettier-plugin-java": "1.6.2",

scripts/husky/format-generators.js

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

scripts/husky/pre-commit.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env node
2-
/* eslint-disable no-console */
3-
/* eslint-disable import/no-commonjs */
4-
/* eslint-disable @typescript-eslint/no-var-requires */
2+
/* eslint-disable no-console, import/no-commonjs, @typescript-eslint/no-var-requires */
53
const chalk = require('chalk');
64
const micromatch = require('micromatch');
75

0 commit comments

Comments
 (0)