Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b24eb1c

Browse files
committedJun 30, 2019
chore(lint-staged): add prettier to lint-staged
1 parent b8ba7db commit b24eb1c

File tree

6 files changed

+29
-13
lines changed

6 files changed

+29
-13
lines changed
 

‎.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"trailingComma": "all",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true
6+
}

‎commitlint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = { extends: ['@commitlint/config-conventional'] };
1+
module.exports = { extends: ["@commitlint/config-conventional"] };

‎package.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
],
1919
"husky": {
2020
"hooks": {
21-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
21+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
22+
"pre-commit": "lint-staged"
2223
}
2324
},
2425
"dependencies": {
@@ -43,7 +44,16 @@
4344
"@types/node": "^12.0.0",
4445
"husky": "^2.7.0",
4546
"jest": "^24.8.0",
47+
"lint-staged": "^8.2.1",
48+
"pre-commit": "^1.2.2",
49+
"prettier": "^1.18.2",
4650
"ts-jest": "^24.0.2",
4751
"ts-node": "^8.1.0"
52+
},
53+
"lint-staged": {
54+
"*.{js,ts,css,json,md}": [
55+
"prettier --write",
56+
"git add"
57+
]
4858
}
4959
}

‎src/controller.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
CURSOR_SIMBOL,
1010
ROW_RESULTS_START,
1111
TARGET_FOLDER,
12-
UI_POSITIONS
12+
UI_POSITIONS,
1313
} from './constants/main.constants';
1414
import { basename, dirname, normalize, resolve } from 'path';
1515

@@ -70,14 +70,14 @@ export class Controller {
7070
this.nodeFolders.push({
7171
path: folder,
7272
size: 0,
73-
deleted: false
73+
deleted: false,
7474
});
7575
this.setCursorAt([3, ROW_RESULTS_START + this.folderNewRow]);
7676
this.print(folder);
7777
// getFolderSize(folder, [90, ROW_RESULTS_START + i]);
7878
this.drawFolderSize(folder, [
7979
this.stdout.columns - 20,
80-
ROW_RESULTS_START + this.folderNewRow
80+
ROW_RESULTS_START + this.folderNewRow,
8181
]);
8282
this.folderNewRow++;
8383
} else {
@@ -91,7 +91,7 @@ export class Controller {
9191
delete: this.delete.bind(this),
9292
execute: function(command: string, params: string[]) {
9393
return this[command](params);
94-
}
94+
},
9595
};
9696

9797
private setupKeysListener() {
@@ -107,7 +107,7 @@ export class Controller {
107107
if (name == 'delete') {
108108
this.KEYS.execute(name, {
109109
nodeFolder: this.nodeFolders[this.cursorPosY - ROW_RESULTS_START],
110-
position: [3, this.cursorPosY]
110+
position: [3, this.cursorPosY],
111111
});
112112
} else {
113113
this.KEYS.execute(name);

‎src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
22

3-
import { Controller } from "./controller";
3+
import { Controller } from './controller';
44

55
const controller = new Controller();

‎src/stuff.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ function newResult(result) {
1818
console.log(result);
1919
}
2020

21-
const fg = require("fast-glob");
21+
const fg = require('fast-glob');
2222

23-
const stream = fg.stream(["../**/[node_modules]/"], {
23+
const stream = fg.stream(['../**/[node_modules]/'], {
2424
onlyDirectories: true,
25-
matchBase: true
25+
matchBase: true,
2626
});
2727

28-
stream.on("data", newResult);
29-
stream.once("error", console.log);
28+
stream.on('data', newResult);
29+
stream.once('error', console.log);
3030

3131
/*---------------
3232
const { lstatSync, readdirSync } = require("fs");

0 commit comments

Comments
 (0)
Please sign in to comment.