Skip to content

Commit 1bb5251

Browse files
authored
chore: setup hooks and format the workspace (#316)
1 parent 86248c5 commit 1bb5251

35 files changed

+4697
-5902
lines changed

.eslintignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package.json
22
package-lock.json
33
dist
4-
e2e/**
54
node_modules/*
65
karma.conf.js
76
commitlint.config.js

.eslintrc.json

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"root": true,
3-
"ignorePatterns": [
4-
"projects/**/*"
5-
],
3+
"ignorePatterns": ["projects/**/*"],
64
"globals": {
75
"document": "readonly",
86
"window": "readonly",
@@ -15,14 +13,9 @@
1513
},
1614
"overrides": [
1715
{
18-
"files": [
19-
"*.ts"
20-
],
16+
"files": ["*.ts"],
2117
"parserOptions": {
22-
"project": [
23-
"tsconfig.json",
24-
"e2e/tsconfig.json"
25-
],
18+
"project": ["tsconfig.json"],
2619
"createDefaultProgram": true
2720
},
2821
"extends": [
@@ -61,12 +54,8 @@
6154
}
6255
},
6356
{
64-
"files": [
65-
"*.html"
66-
],
67-
"extends": [
68-
"plugin:@angular-eslint/template/recommended"
69-
],
57+
"files": ["*.html"],
58+
"extends": ["plugin:@angular-eslint/template/recommended"],
7059
"rules": {}
7160
}
7261
]

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ yarn-error.log
4444
testem.log
4545
/typings
4646

47-
# e2e
48-
/e2e/*.js
49-
/e2e/*.map
50-
5147
# System Files
5248
.DS_Store
5349
Thumbs.db

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit $1

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged

angular.json

+5-46
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,8 @@
2222
"main": "src/main.ts",
2323
"polyfills": "src/polyfills.ts",
2424
"tsConfig": "src/tsconfig.app.json",
25-
"assets": [
26-
"src/favicon.ico",
27-
"src/assets"
28-
],
29-
"styles": [
30-
"src/styles.scss"
31-
],
25+
"assets": ["src/favicon.ico", "src/assets"],
26+
"styles": ["src/styles.scss"],
3227
"scripts": [],
3328
"vendorChunk": true,
3429
"extractLicenses": false,
@@ -48,7 +43,6 @@
4843
"optimization": true,
4944
"outputHashing": "all",
5045
"sourceMap": false,
51-
"extractCss": true,
5246
"namedChunks": false,
5347
"extractLicenses": true,
5448
"vendorChunk": false,
@@ -91,49 +85,15 @@
9185
"polyfills": "src/polyfills.ts",
9286
"tsConfig": "src/tsconfig.spec.json",
9387
"karmaConfig": "src/karma.conf.js",
94-
"styles": [
95-
"src/styles.scss"
96-
],
88+
"styles": ["src/styles.scss"],
9789
"scripts": [],
98-
"assets": [
99-
"src/favicon.ico",
100-
"src/assets"
101-
]
90+
"assets": ["src/favicon.ico", "src/assets"]
10291
}
10392
},
10493
"lint": {
10594
"builder": "@angular-eslint/builder:lint",
10695
"options": {
107-
"exclude": [
108-
"**/node_modules/**"
109-
]
110-
}
111-
}
112-
}
113-
},
114-
"ngx-drag-scroll-demo-e2e": {
115-
"root": "e2e/",
116-
"projectType": "application",
117-
"prefix": "",
118-
"architect": {
119-
"e2e": {
120-
"builder": "@angular-devkit/build-angular:protractor",
121-
"options": {
122-
"protractorConfig": "e2e/protractor.conf.js",
123-
"devServerTarget": "ngx-drag-scroll-demo:serve"
124-
},
125-
"configurations": {
126-
"production": {
127-
"devServerTarget": "ngx-drag-scroll-demo:serve:production"
128-
}
129-
}
130-
},
131-
"lint": {
132-
"builder": "@angular-eslint/builder:lint",
133-
"options": {
134-
"exclude": [
135-
"**/node_modules/**"
136-
]
96+
"exclude": ["**/node_modules/**"]
13797
}
13898
}
13999
}
@@ -170,7 +130,6 @@
170130
}
171131
}
172132
},
173-
"defaultProject": "ngx-drag-scroll-demo",
174133
"cli": {
175134
"analytics": false
176135
},

commitlint.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
module.exports = {
2-
extends: [
3-
'@commitlint/config-angular'
4-
]
2+
extends: ['@commitlint/config-conventional']
53
};

copy-artifacts.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
const fs = require("fs");
2-
const path = require("path");
1+
const fs = require('fs');
2+
const path = require('path');
33

4-
const artifacts = ["CHANGELOG.md", "LICENSE", "README.md"];
5-
artifacts.forEach(artifact => {
4+
const artifacts = ['CHANGELOG.md', 'LICENSE', 'README.md'];
5+
artifacts.forEach((artifact) => {
66
const fromPath = path.resolve(__dirname, artifact);
7-
const toPath = path.resolve(__dirname, "dist/ngx-drag-scroll", artifact);
7+
const toPath = path.resolve(__dirname, 'dist/ngx-drag-scroll', artifact);
88

9-
fs.readFile(fromPath, "utf-8", (err, data) => {
9+
fs.readFile(fromPath, 'utf-8', (err, data) => {
1010
if (err) {
11-
console.log("an error occured while reading file ", fromPath);
11+
console.log('an error occured while reading file ', fromPath);
1212
return;
1313
}
14-
fs.writeFile(toPath, data, err => {
14+
fs.writeFile(toPath, data, (err) => {
1515
if (err) {
16-
console.log("an error occured while writing file ", toPath);
16+
console.log('an error occured while writing file ', toPath);
1717
return;
1818
}
1919
console.log(`${artifact} copied`);

e2e/src/app.e2e-spec.ts

-23
This file was deleted.

e2e/src/app.po.ts

-11
This file was deleted.

e2e/tsconfig.e2e.json

-13
This file was deleted.

lint-staged.config.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
'**/*.{ts,js,json,md,scss,html,yml}': 'prettier --write'
3+
};

0 commit comments

Comments
 (0)