Skip to content

Commit be466e1

Browse files
committed
WT-10967: Add eslint configuration
This adds the lint script to package.yaml, and an .eslintrc.yml with the configuration for Wt. For gulpfile.js we have to indicate that it is using the node env, so eslint doesn't report that require doesn't exist.
1 parent a755cf3 commit be466e1

File tree

5 files changed

+698
-0
lines changed

5 files changed

+698
-0
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.min.js
2+
jquery.js

.eslintrc.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
env:
2+
browser: true
3+
es2021: true
4+
extends: eslint:recommended
5+
overrides: []
6+
globals:
7+
WT_DECLARE_APP_MEMBER: readonly
8+
WT_DECLARE_WT_MEMBER: readonly
9+
WT_DECLARE_WT_MEMBER_BIG: readonly
10+
JavaScriptFunction: readonly
11+
JavaScriptConstructor: readonly
12+
JavaScriptObject: readonly
13+
JavaScriptPrototype: readonly
14+
parserOptions:
15+
ecmaVersion: latest
16+
rules:
17+
# Possible Problems
18+
no-constructor-return:
19+
- error
20+
no-inner-declarations:
21+
- off
22+
no-unused-vars:
23+
- error
24+
- argsIgnorePattern: ^_
25+
varsIgnorePattern: ^_
26+
# Suggestions
27+
consistent-return:
28+
- error
29+
eqeqeq:
30+
- error
31+
guard-for-in:
32+
- error
33+
no-implicit-globals:
34+
- error
35+
no-sequences:
36+
- error
37+
no-undefined:
38+
- error
39+
no-var:
40+
- error
41+
prefer-const:
42+
- error
43+
# Layout & Formatting
44+
# dprint does not reformat comments,
45+
# this catches max-len violations in comments:
46+
max-len:
47+
- error
48+
- code: 120
49+
tabWidth: 8

src/js/gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-env node */
12
const gulp = require("gulp");
23
const rename = require("gulp-rename");
34
const terser = require("gulp-terser");

src/js/package.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ scripts:
33
minify: gulp
44
fmt: cd ../.. && dprint fmt
55
checkfmt: cd ../.. && dprint check
6+
lint:
7+
"cd ../.. && \
8+
eslint --config ./.eslintrc.yml --ignore-path ./.eslintignore src/js src/web/skeleton"
69
author: Emweb bv
710
license : GPL-2.0-only
811
private: true
912
devDependencies:
1013
dprint: ^0.32.1
14+
eslint: ^8.25.0
1115
gulp: ^4.0.2
1216
gulp-rename: ^2.0.0
1317
gulp-terser: ^2.1.0

0 commit comments

Comments
 (0)