Skip to content

Commit 7110bed

Browse files
authored
[ZEPPELIN-6305] Modify package.json so that lint and prettier cover projects folder
### What is this PR for? > This PR for **zeppeling-web-angular** In `npm run lint`, `projects folder` is linted using ng, but `prettier` only checks the `src folder`. In `lint-staged`, neither lint nor `prettier` checks the `projects folder`. This seems to need fixing. Because `ng lint --fix` is not supported, I added a `lint:fix` script to run `tslint` with the `--fix` option. Since src and projects folders need to reference different tslint configs, I added the corresponding option to `lint-staged`. ### What type of PR is it? Bug Fix Improvement ### Todos ### What is the Jira issue? * [[ZEPPELIN-6305](https://issues.apache.org/jira/browse/ZEPPELIN-6305)] ### How should this be tested? ### Screenshots (if appropriate) ### Questions: * Does the license files need to update? N * Is there breaking changes for older versions? N * Does this needs documentation? N Closes #5054 from dididy/fix/ZEPPELIN-6305. Signed-off-by: ChanHo Lee <[email protected]>
1 parent 320c1a2 commit 7110bed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+190
-335
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
**/*.md
22
**/*.less
33
**/*.svg
4+
5+
dist/*
6+
node/*
7+
node_modules/*
8+
target/*
9+
tslint-rules/**/*.js

zeppelin-web-angular/angular.json

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,7 @@
7676
"./node_modules/github-markdown-css/github-markdown.css"
7777
],
7878
"stylePreprocessorOptions": {
79-
"includePaths": [
80-
"src/styles/theme",
81-
"src/styles/theme/dark",
82-
"src/styles/theme/light"
83-
]
79+
"includePaths": ["src/styles/theme", "src/styles/theme/dark", "src/styles/theme/light"]
8480
},
8581
"scripts": [
8682
"node_modules/mathjax/MathJax.js",
@@ -134,26 +130,16 @@
134130
"polyfills": "src/polyfills.ts",
135131
"tsConfig": "src/tsconfig.spec.json",
136132
"karmaConfig": "src/karma.conf.js",
137-
"styles": [
138-
"src/styles.less"
139-
],
133+
"styles": ["src/styles.less"],
140134
"scripts": [],
141-
"assets": [
142-
"src/favicon.ico",
143-
"src/assets"
144-
]
135+
"assets": ["src/favicon.ico", "src/assets"]
145136
}
146137
},
147138
"lint": {
148139
"builder": "@angular-devkit/build-angular:tslint",
149140
"options": {
150-
"tsConfig": [
151-
"src/tsconfig.app.json",
152-
"src/tsconfig.spec.json"
153-
],
154-
"exclude": [
155-
"**/node_modules/**"
156-
]
141+
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
142+
"exclude": ["**/node_modules/**"]
157143
}
158144
}
159145
}
@@ -179,9 +165,7 @@
179165
"builder": "@angular-devkit/build-angular:tslint",
180166
"options": {
181167
"tsConfig": "e2e/tsconfig.json",
182-
"exclude": [
183-
"**/node_modules/**"
184-
]
168+
"exclude": ["**/node_modules/**"]
185169
}
186170
}
187171
}
@@ -210,13 +194,8 @@
210194
"lint": {
211195
"builder": "@angular-devkit/build-angular:tslint",
212196
"options": {
213-
"tsConfig": [
214-
"projects/zeppelin-helium/tsconfig.lib.json",
215-
"projects/zeppelin-helium/tsconfig.spec.json"
216-
],
217-
"exclude": [
218-
"**/node_modules/**"
219-
]
197+
"tsConfig": ["projects/zeppelin-helium/tsconfig.lib.json", "projects/zeppelin-helium/tsconfig.spec.json"],
198+
"exclude": ["**/node_modules/**"]
220199
}
221200
}
222201
}
@@ -249,9 +228,7 @@
249228
"projects/helium-vis-example/tsconfig.lib.json",
250229
"projects/helium-vis-example/tsconfig.spec.json"
251230
],
252-
"exclude": [
253-
"**/node_modules/**"
254-
]
231+
"exclude": ["**/node_modules/**"]
255232
}
256233
}
257234
}
@@ -284,9 +261,7 @@
284261
"projects/zeppelin-visualization/tsconfig.lib.json",
285262
"projects/zeppelin-visualization/tsconfig.spec.json"
286263
],
287-
"exclude": [
288-
"**/node_modules/**"
289-
]
264+
"exclude": ["**/node_modules/**"]
290265
}
291266
}
292267
}
@@ -315,17 +290,12 @@
315290
"lint": {
316291
"builder": "@angular-devkit/build-angular:tslint",
317292
"options": {
318-
"tsConfig": [
319-
"projects/zeppelin-sdk/tsconfig.lib.json",
320-
"projects/zeppelin-sdk/tsconfig.spec.json"
321-
],
322-
"exclude": [
323-
"**/node_modules/**"
324-
]
293+
"tsConfig": ["projects/zeppelin-sdk/tsconfig.lib.json", "projects/zeppelin-sdk/tsconfig.spec.json"],
294+
"exclude": ["**/node_modules/**"]
325295
}
326296
}
327297
}
328298
}
329299
},
330300
"defaultProject": "zeppelin"
331-
}
301+
}

zeppelin-web-angular/e2e/protractor.conf.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ const { SpecReporter } = require('jasmine-spec-reporter');
2121
*/
2222
exports.config = {
2323
allScriptsTimeout: 11000,
24-
specs: [
25-
'./src/**/*.e2e-spec.ts'
26-
],
24+
specs: ['./src/**/*.e2e-spec.ts'],
2725
capabilities: {
28-
'browserName': 'chrome'
26+
browserName: 'chrome'
2927
},
3028
directConnect: true,
3129
baseUrl: 'http://localhost:4200/',
@@ -41,4 +39,4 @@ exports.config = {
4139
});
4240
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
4341
}
44-
};
42+
};

zeppelin-web-angular/e2e/src/app.e2e-spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ describe('workspace-project App', () => {
2727

2828
afterEach(async () => {
2929
// Assert that there are no errors emitted from the browser
30-
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
31-
expect(logs).not.toContain(jasmine.objectContaining({
32-
level: logging.Level.SEVERE
33-
} as logging.Entry));
30+
const logs = await browser
31+
.manage()
32+
.logs()
33+
.get(logging.Type.BROWSER);
34+
expect(logs).not.toContain(
35+
jasmine.objectContaining({
36+
level: logging.Level.SEVERE
37+
} as logging.Entry)
38+
);
3439
});
3540
});

zeppelin-web-angular/e2e/tsconfig.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
"outDir": "../out-tsc/e2e",
55
"module": "commonjs",
66
"target": "es5",
7-
"types": [
8-
"jasmine",
9-
"jasminewd2",
10-
"node"
11-
]
7+
"types": ["jasmine", "jasminewd2", "node"]
128
}
139
}

zeppelin-web-angular/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Karma configuration file, see link for more information
1414
// https://karma-runner.github.io/1.0/config/configuration-file.html
1515

16-
module.exports = function (config) {
16+
module.exports = function(config) {
1717
config.set({
1818
basePath: '',
1919
frameworks: ['jasmine', '@angular-devkit/build-angular'],

zeppelin-web-angular/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"build-project:vis": " ng build --project zeppelin-visualization",
1414
"build-project:helium": "ng build --project zeppelin-helium",
1515
"test": "ng test",
16-
"lint": "ng lint && prettier --check \"src/**/*.{ts,js,css,html}\"",
16+
"lint": "ng lint && tslint tslint-rules/*.ts && prettier --check \"**/*.{ts,js,json,css,html}\"",
17+
"lint:fix": "ng lint --fix && tslint --fix tslint-rules/*.ts && prettier --write \"**/*.{ts,js,json,css,html}\"",
1718
"e2e": "ng e2e"
1819
},
1920
"engines": {
@@ -88,12 +89,13 @@
8889
"typescript": "3.8.3"
8990
},
9091
"lint-staged": {
91-
"src/**/*.{ts,js,json}": [
92+
"**/*.ts": [
93+
"tslint --fix",
9294
"./node_modules/.bin/prettier --write",
9395
"git add"
9496
],
95-
"src/**/*.ts": [
96-
"tslint --project src/tslint.json --fix",
97+
"**/*.{js,json,css,html}": [
98+
"./node_modules/.bin/prettier --write",
9799
"git add"
98100
]
99101
},

zeppelin-web-angular/projects/helium-vis-example/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Karma configuration file, see link for more information
1414
// https://karma-runner.github.io/1.0/config/configuration-file.html
1515

16-
module.exports = function (config) {
16+
module.exports = function(config) {
1717
config.set({
1818
basePath: '',
1919
frameworks: ['jasmine', '@angular-devkit/build-angular'],

zeppelin-web-angular/projects/helium-vis-example/ng-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"lib": {
55
"entryFile": "src/public-api.ts"
66
}
7-
}
7+
}

zeppelin-web-angular/projects/helium-vis-example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"@angular/common": "^8.2.9",
66
"@angular/core": "^8.2.9"
77
}
8-
}
8+
}

0 commit comments

Comments
 (0)