@jslint-org/jslint 2022.3.30 → 2022.5.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmignore +6 -0
- package/CHANGELOG.md +255 -0
- package/README.md +189 -35
- package/asset_codemirror_rollup.js +11458 -0
- package/asset_font_daley_bold.woff2 +0 -0
- package/asset_image_folder_open_solid.svg +1 -0
- package/asset_image_github_brands.svg +1 -0
- package/asset_image_jslint_wrapper_vim.png +0 -0
- package/asset_image_jslint_wrapper_vscode.png +0 -0
- package/asset_image_json_160.svg +104 -0
- package/asset_image_logo_512.png +0 -0
- package/asset_image_logo_512.svg +39 -0
- package/jslint.mjs +407 -142
- package/jslint_wrapper_cjs.cjs +28 -0
- package/jslint_wrapper_vscode.js +178 -0
- package/package.json +6 -2
package/.npmignore
CHANGED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
# Todo
|
|
4
|
+
- cli - remove cli-option `--mode-vim-plugin`
|
|
5
|
+
- coverage - add macros `/*coverage-disable*/` and `/*coverage-enable*/`.
|
|
6
|
+
- jslint - add html and css linting back into jslint.
|
|
7
|
+
- jslint - add new warning requiring paren around plus-separated concatenations.
|
|
8
|
+
- jslint - relax warning against console.log and friends and deprecate directive `devel`
|
|
9
|
+
- jslint - require regexp to use open-form.
|
|
10
|
+
- jslint - try to improve parser to be able to parse jquery.js without stopping.
|
|
11
|
+
- jslint - unify analysis of variable-assignment/function-parameters into one function
|
|
12
|
+
- jslint - add new warning "Expected Object.create(null) instead of {}"
|
|
13
|
+
- node - after node-v14 is deprecated, remove shell-code `export "NODE_OPTIONS=--unhandled-rejections=strict"`.
|
|
14
|
+
|
|
15
|
+
# v2022.5.20
|
|
16
|
+
- coverage-report - disable default-coverage of directory `node_modules`, but allow override with cli-option `--include-node-modules=1`
|
|
17
|
+
- coverage-report - add function globExclude() to revamp coverage-report to exclude files using glob-pattern-matching
|
|
18
|
+
- add codemirror-example-file jslint_wrapper_codemirror.html
|
|
19
|
+
- update codemirror-editor to v5.65.3
|
|
20
|
+
- wrapper - add jslint-addon for codemirror
|
|
21
|
+
- allow jslint.mjs to auto-export itself to globalThis when given search-param `?window_jslint=1`
|
|
22
|
+
- wrapper - add jslint-extension for vscode
|
|
23
|
+
- bugfix - fix jslint falsely believing megastring literals `0` and `1` are similar
|
|
24
|
+
- bugfix - fix function jstestOnExit() from exiting prematurely and suppressing additional error-messages
|
|
25
|
+
|
|
26
|
+
# v2022.3.30
|
|
27
|
+
- website - use localStorage to persist jslint-options selected in ui
|
|
28
|
+
- website - add optional debug-mode to use sessionStorage to persist jslint-globals and jslint-source from ui
|
|
29
|
+
- jslint - add numeric-separator support
|
|
30
|
+
- jslint - move regexp-literals to module-level so they are explicitly cached, to improve performance
|
|
31
|
+
- ci - add check for package.json.fileCount
|
|
32
|
+
|
|
33
|
+
# v2022.2.20
|
|
34
|
+
- test - migrate all tests to use jstestDescribe(), jstestIt()
|
|
35
|
+
- fs - rename jslint-wrapper-files to jslint_wrapper_xxx.xxx
|
|
36
|
+
- bugfix - fix issue #382 - make fart-related warnings more readable
|
|
37
|
+
- bugfix - fix issue #382 - fix warnings against destructured fart
|
|
38
|
+
- bugfix - fix issue #379 - warn against naked-statement in fart.
|
|
39
|
+
- update commonjs-wrapper jslint.cjs to load jslint in strict-mode.
|
|
40
|
+
|
|
41
|
+
# v2021.12.20
|
|
42
|
+
- npm - add file jslint.cjs so package @jslint-org/jslint can be published as dual-module
|
|
43
|
+
- jslint - relax warning "function_in_loop"
|
|
44
|
+
- update function assertJsonEqual to JSON.stringify 3rd param if its an object
|
|
45
|
+
|
|
46
|
+
# v2021.11.20
|
|
47
|
+
- jslint - add top-level-await support
|
|
48
|
+
- ci - deprecate/remove jslint.cjs from ci
|
|
49
|
+
- coverage - add cli-options `--exclude=aa,bb`, `--exclude-node-modules=false`, `--include=aa,bb`
|
|
50
|
+
- coverage - dedupe coverage-logic now applied when only one script passed
|
|
51
|
+
- npm - add file .npmignore
|
|
52
|
+
- website - add clickable-links to editor-code in report-warnings and report-functions
|
|
53
|
+
|
|
54
|
+
# v2021.10.20
|
|
55
|
+
- ci - add release-trigger to publish to `@jslint-org/jslint`
|
|
56
|
+
- bugfix - fix coverage-report having incorrect http-link to index.html
|
|
57
|
+
- bugfix - fix false warning `uninitialized 'bb'` in code `/*jslint node*/\nlet {aa:bb} = {}; bb();`
|
|
58
|
+
- bugfix - fix issue #358 - switch-statement crashes jslint
|
|
59
|
+
- ci - cache coverage-example node-sqlite3 to speed up ci
|
|
60
|
+
- ci - rename dir .build/ to .artifact/
|
|
61
|
+
- ci - update shell-function shRunWithCoverage() to reduce size of string/argument passed to nodejs by using 2-space-indent
|
|
62
|
+
- cli - add cli-command jslint_plugin_vim
|
|
63
|
+
- cli - add cli-command v8_coverage_report
|
|
64
|
+
- cli - change cli-option `--mode-report` to cli-command `jslint_report=<filename>`
|
|
65
|
+
- coverage - relax requirement for coverageDir to be in cwd
|
|
66
|
+
- deprecated - cli - add cli-option `--mode-report`
|
|
67
|
+
- doc - add api-documentation
|
|
68
|
+
- fs - merge file asset_codemirror_rollup.css into index.html
|
|
69
|
+
- fs - merge file browser.mjs into index.html
|
|
70
|
+
- fs - merge file function.html into help.html
|
|
71
|
+
- fs - remove little-used font asset_font_programma_bold.woff2
|
|
72
|
+
- fs - rename files with dashes to files with underscore
|
|
73
|
+
- jslint - disable linting of embedded javascript in markdown-files
|
|
74
|
+
- jslint - relax regexp-warning against using 'space'
|
|
75
|
+
- npm - add file package.json and command `npm test`
|
|
76
|
+
- style - change naming-convention for non-jslint-core code from underscore to camelCase
|
|
77
|
+
- test - add mocha-like test-functions jstestDescribe, jstestIt
|
|
78
|
+
|
|
79
|
+
# v2021.9.20
|
|
80
|
+
- jslint - add bigint support.
|
|
81
|
+
- vim - add vim-plugin and file jslint.vim.
|
|
82
|
+
- doc - auto-generate toc for README.md
|
|
83
|
+
- jslint - rename little-used directive `debug` to `trace` to avoid confusion with non-related directive `devel`.
|
|
84
|
+
|
|
85
|
+
# v2021.8.20
|
|
86
|
+
- warning - disable un-ergonomic warnings restricting directive-global (missing_browser and unexpected_directive_a).
|
|
87
|
+
- fs - rename file ci.sh to jslint_ci.sh.
|
|
88
|
+
- license - add codemirror license to rollup-assets.
|
|
89
|
+
- website - display number of warnings, properties, functions in report.
|
|
90
|
+
- website - fix uiLoader getting hidden behind highlighted text.
|
|
91
|
+
|
|
92
|
+
# v2021.7.24
|
|
93
|
+
- bugfix - fix jslint not warning about function-redefinition when function is defined inside a call.
|
|
94
|
+
- bugfix - fix website crashing when linting pure json-object.
|
|
95
|
+
- ci - fix race-condition when inlining css.
|
|
96
|
+
- doc - update README.md with links to archived web-demos.
|
|
97
|
+
- jslint - add new beta-warning against redefining global-variables.
|
|
98
|
+
- jslint - add new beta-warning if functions are unordered.
|
|
99
|
+
- jslint - add new warning disallowing string-literal as property-name, e.g. {`aa`:0}.
|
|
100
|
+
- jslint - comment out shebang in jslint.mjs so older ios devices can use website.
|
|
101
|
+
- jslint - deprecate directive `/*jslint eval*/` - use `//jslint-quiet` instead.
|
|
102
|
+
- jslint-revamp - rearrange functions in jslint.mjs to comply with ordered-functions beta-warning.
|
|
103
|
+
- jslint-revamp - revamp cause-based testing with more robust instrumentation.
|
|
104
|
+
- tests - test artifact and column-position in warnings are correct.
|
|
105
|
+
|
|
106
|
+
# v2021.6.30
|
|
107
|
+
- breaking-change - rename files *.js to *.mjs for better integration with nodejs.
|
|
108
|
+
- ci - auto-screenshot example-shell-commands in README.md.
|
|
109
|
+
- ci - include explicit commonjs (jslint.cjs) and es-module (jslint.mjs) variants of jslint.
|
|
110
|
+
- jslint - disable out-of-scope warning for functions.
|
|
111
|
+
- jslint - reintroduce directive `/*jslint indent2*/` - allow 2-space indent.
|
|
112
|
+
- license - change license to public-domain/unlicense.
|
|
113
|
+
- website - create codemirror-plugin to highlight jslint-warnings in editor.
|
|
114
|
+
|
|
115
|
+
# v2021.6.22
|
|
116
|
+
- bugfix - fix global_list being ignored by jslint.
|
|
117
|
+
- bugfix - fix no-warning when exception in catch-block is unused.
|
|
118
|
+
- ci - migrate ci-scripts from cjs to esm.
|
|
119
|
+
- cli - add env-variable \$JSLINT_BETA.
|
|
120
|
+
- jslint - add new directive `/*jslint beta*/` - enable features currently in beta.
|
|
121
|
+
- jslint - add new directive `/*jslint variable*/` - allow unordered variable-declarations that are not at top of function-scope.
|
|
122
|
+
- jslint - add new warning if const/let/var statements are not declared at top of function-scope.
|
|
123
|
+
- jslint - add new warning if const/let/var statements are unordered.
|
|
124
|
+
- website - invalidate url-cache with each deployment.
|
|
125
|
+
- website - replace .png logo with .svg logo.
|
|
126
|
+
- website - replace current-editor with CodeMirror-editor and change programming-font-family from `Programma` to `consolas, menlo, monospace`.
|
|
127
|
+
|
|
128
|
+
# v2021.6.12
|
|
129
|
+
- bugfix - fix await expression/statement inside catch-statement not registered by functionage.await.
|
|
130
|
+
- bugfix - fix cli appending slash "/" to normalized filename.
|
|
131
|
+
- bugfix - fix issue #316, #317 - jslint complains about dynamic-import.
|
|
132
|
+
- bugfix - fix misleading warning describing alphabetical-order instead of ascii-order.
|
|
133
|
+
- bugfix - fix off-by-one-column bug in missing-semicolon-warning.
|
|
134
|
+
- bugfix - fix try-catch-block complaining about "Unexpected await" inside async-function.
|
|
135
|
+
- directive - re-introduce `/*jslint name*/` to ignore "Bad property name" warning.
|
|
136
|
+
- doc - add install-screenshots.
|
|
137
|
+
- jslint - add new warning if case-statements are not sorted.
|
|
138
|
+
- jslint - add warning for unexpected ? in example `aa=/.{0}?/`.
|
|
139
|
+
- jslint - add warning for unexpected-expr in example `async function aa(){await 0;}`.
|
|
140
|
+
- jslint-refactor-1 - make "stateful" variables scoped outside of jslint() "stateless" by moving them into jslint().
|
|
141
|
+
- jslint-refactor-2 - inline constants anticondition, bitwiseop, escapeable, and opener directly into code.
|
|
142
|
+
- jslint-refactor-3 - inline regexp-functions quantifier(), ranges(), klass(), choice(), directly into code.
|
|
143
|
+
- jslint-refactor-4 - document jslint process and each recursion-loop converted to while-loop.
|
|
144
|
+
- remove unnecessary variables nr.
|
|
145
|
+
- rename artifact-related variables a, b to let artifact_now, artifact_nxt.
|
|
146
|
+
- rename functions make() to token_create().
|
|
147
|
+
- reorganize/rename "global" variables by topical-prefixes:
|
|
148
|
+
artifact_xxx, export_xxx, from_xxx, import_xxx, line_xxx, mode_xxx, token_xxx
|
|
149
|
+
- jslint-refactor-5 - split jslint-core-logic into 5-phases.
|
|
150
|
+
- move phase-sub-functions out of function-jslint().
|
|
151
|
+
- move global-vars into state-object, that can be passed between functions.
|
|
152
|
+
- migrate recursive-loops to while-loops in sub-function phase2_lex().
|
|
153
|
+
- move remaining global-vars into sub-functions or hardcode.
|
|
154
|
+
- update functions artifact(), stop(), warn() with fallback-code `the_token = the_token || state.token_nxt;`.
|
|
155
|
+
- website - add ui-loader-animation.
|
|
156
|
+
|
|
157
|
+
# v2021.6.3
|
|
158
|
+
- breaking-change - hardcode `const fudge = 1`
|
|
159
|
+
- breaking-change - remove little-used-feature allowing jslint to accept array-of-strings as source b/c internal lines-object has been changed from array-of-strings to array-of-objects.
|
|
160
|
+
- doc - add svg changelog.
|
|
161
|
+
- doc - add svg package-listing.
|
|
162
|
+
- doc - document cli-feature to jslint entire directory.
|
|
163
|
+
- jslint - add eslint-like ignore-directives `/*jslint-disable*/`, `/*jslint-enable*/`, `//jslint-quiet`.
|
|
164
|
+
- jslint - add new warning `Directive /*jslint-disable*/ was not closed with /*jslint-enable*/.`.
|
|
165
|
+
- jslint - add new warning `Directive /*jslint-enable*/ was not opened with /*jslint-disable*/.`.
|
|
166
|
+
- jslint - remove obsolete ie-era warning about duplicate names for caught-errors.
|
|
167
|
+
- website - move options-ui to top of page after editor-ui
|
|
168
|
+
|
|
169
|
+
# v2021.5.30
|
|
170
|
+
- bugfix - fix issue #282 - fail to warn trailing semicolon in `export default Object.freeze({})`.
|
|
171
|
+
- ci - 100% code-coverage!
|
|
172
|
+
- ci - auto-update changelog in README.md from CHANGELOG.md.
|
|
173
|
+
- ci - auto-update version numbers in README.md and jslint.js from CHANGELOG.md.
|
|
174
|
+
- deadcode - replace with assertion-check in function choice() - `if (char === "|") { warn... }`.
|
|
175
|
+
- deadcode - replace with assertion-check in function do_function() - `if (mega_mode) { warn... }`.
|
|
176
|
+
- deadcode - replace with assertion-check in function no_space() - `const at = (free ? ...)`.
|
|
177
|
+
- deadcode - replace with assertion-check in function no_space() - `if (open) {...}`.
|
|
178
|
+
- deadcode - replace with assertion-check in function parse_directive() - `} else if (value === "false") {...}`.
|
|
179
|
+
- deadcode - replace with assertion-check in function supplant() - `return ( replacement !== undefined ?...)`.
|
|
180
|
+
- jslint - cleanup regexp code using switch-case-statements.
|
|
181
|
+
- jslint - inline function `activate` into function `action_var`.
|
|
182
|
+
- jslint - inline-document each deadcode-removal/assertion-check.
|
|
183
|
+
- jslint - inline-document each warning with cause that can reproduce it - part 2.
|
|
184
|
+
- tests - inline remaining causal-regressions from test.js into jslint.js
|
|
185
|
+
- tests - validate inline-multi-causes are sorted.
|
|
186
|
+
- website - replace links `branch.xxx` with `branch-xxx`.
|
|
187
|
+
|
|
188
|
+
# v2021.5.27
|
|
189
|
+
- ci - fix expectedWarningCode not being validated.
|
|
190
|
+
- ci - in windows, disable git-autocrlf.
|
|
191
|
+
- deadcode - replace with assertion-check in function are_similar() - "if (a === b) { return true }".
|
|
192
|
+
- deadcode - replace with assertion-check in function are_similar() superseded by id-check - "if (Array.isArray(b)) { return false; }".
|
|
193
|
+
- deadcode - replace with assertion-check in function are_similar() superseded by is_weird() check - "if (a.arity === "function" && a.arity ===...c".
|
|
194
|
+
- jslint - add directive `test_internal_error`.
|
|
195
|
+
- jslint - add directive `unordered` to tolerate unordered properties and params.
|
|
196
|
+
- jslint - inline-document each warning with cause that can reproduce it - part 1.
|
|
197
|
+
- style - refactor code moving infix-operators from post-position to pre-position in multiline statements.
|
|
198
|
+
- website - add hotkey ctrl-enter to run jslint.
|
|
199
|
+
|
|
200
|
+
# v2021.5.26
|
|
201
|
+
- ci - fix ci silently failing in node-v12 and node-v14.
|
|
202
|
+
- cli - add env var JSLINT_CLI to force-trigger cli in jslint.js (used for code-coverage of cli).
|
|
203
|
+
- jslint - add "globalThis" to default globals.
|
|
204
|
+
- jslint - add new rules unordered_param_a, unordered_property_a, that warn if parameters and properties are listed in nonascii-order.
|
|
205
|
+
- jslint - fix bug where (global) functionage missing properties finally and try.
|
|
206
|
+
- jslint - fix bug failing to parse unicode "\\u{12345}".
|
|
207
|
+
- jslint - fix bug falsely warning against conditional-chaining-operator "?.".
|
|
208
|
+
- jslint - remove deadcode for preaction-binary-".".
|
|
209
|
+
- jslint - remove deadcode warning bad_option_a.
|
|
210
|
+
- website - add fork-me ribbon.
|
|
211
|
+
- website - load index.html with example code.
|
|
212
|
+
- website - merge file report.js into browser.js.
|
|
213
|
+
|
|
214
|
+
# v2021.5.23
|
|
215
|
+
- doc - add section Changelog.
|
|
216
|
+
- doc - update README.md with installation instructions.
|
|
217
|
+
- cli - merge shell-function shJslintCli into jslint.js.
|
|
218
|
+
- jslint - update default globals with support for "import".
|
|
219
|
+
- jslint - sort warnings with higher priority for early_stop.
|
|
220
|
+
- jslint - add async/await support.
|
|
221
|
+
- ci - make branch-beta the default branch.
|
|
222
|
+
- ci - validate non-http/file links in *.md files.
|
|
223
|
+
- ci - add shell-functions shCiBranchPromote.
|
|
224
|
+
|
|
225
|
+
# v2021.5.21
|
|
226
|
+
- this ci-release does not change any core-functionality of file jslint.js.
|
|
227
|
+
- doc - add file CHANGELOG.md.
|
|
228
|
+
- ci - begin addng regression tests and improve code-coverage.
|
|
229
|
+
- ci - allow pull-requests to run restricted-ci (cannot upload artifacts).
|
|
230
|
+
- gh-pages - fix missing assets and insecure http-links.
|
|
231
|
+
- gh-pages - merge file jslint.css into index.html.
|
|
232
|
+
- gh-pages - add files image-jslint-xxx.png.
|
|
233
|
+
- gh-pages - cleanup asset naming-convention.
|
|
234
|
+
- fix missing fonts in function.html and help.html.
|
|
235
|
+
- add files .gitconfig, Daley-Bold.woff2, Programma-Bold.woff2, icon-folder-open-solid.svg, icon-window-maximize-regular.svg.
|
|
236
|
+
- ci - fix http-links after moving to jslint-org.
|
|
237
|
+
- doc - migrate file README to README.md with embedded ci links and screenshots.
|
|
238
|
+
- ci - add macos and windows to ci-matrix.
|
|
239
|
+
- ci - ci now fails if jslint-check fails for any of the files in branches.
|
|
240
|
+
- ci - add github-workflows to generate code-coverage for jslint.js.
|
|
241
|
+
|
|
242
|
+
# v2020.11.6
|
|
243
|
+
- last jslint version before jslint-org migration.
|
|
244
|
+
|
|
245
|
+
# v2018.4.25
|
|
246
|
+
- last jslint version written in commonjs.
|
|
247
|
+
|
|
248
|
+
# v2017.11.6
|
|
249
|
+
- last jslint version written in es5.
|
|
250
|
+
|
|
251
|
+
# v2014.7.8
|
|
252
|
+
- last jslint version before 2 year hiatus.
|
|
253
|
+
|
|
254
|
+
# v2013.3.13
|
|
255
|
+
- last jslint version that can lint .html and .css files.
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ Douglas Crockford <douglas@crockford.com>
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# Status
|
|
6
|
-
| Branch | [master<br>(v2022.
|
|
6
|
+
| Branch | [master<br>(v2022.5.20)](https://github.com/jslint-org/jslint/tree/master) | [beta<br>(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha<br>(Development)](https://github.com/jslint-org/jslint/tree/alpha) |
|
|
7
7
|
|--:|:--:|:--:|:--:|
|
|
8
8
|
| CI | [](https://github.com/jslint-org/jslint/actions?query=branch%3Amaster) | [](https://github.com/jslint-org/jslint/actions?query=branch%3Abeta) | [](https://github.com/jslint-org/jslint/actions?query=branch%3Aalpha) |
|
|
9
9
|
| Coverage | [](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/index.html) | [](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/index.html) | [](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/index.html) |
|
|
@@ -21,7 +21,7 @@ Douglas Crockford <douglas@crockford.com>
|
|
|
21
21
|
3. [API Doc](#api-doc)
|
|
22
22
|
|
|
23
23
|
4. [Quickstart Install](#quickstart-install)
|
|
24
|
-
- [To install, just download https://www.jslint.com/jslint.mjs
|
|
24
|
+
- [To install, just download and save https://www.jslint.com/jslint.mjs to file:](#to-install-just-download-and-save-httpswwwjslintcomjslintmjs-to-file)
|
|
25
25
|
- [To run `jslint.mjs` in shell:](#to-run-jslintmjs-in-shell)
|
|
26
26
|
- [To import `jslint.mjs` in ES Module environment:](#to-import-jslintmjs-in-es-module-environment)
|
|
27
27
|
- [To import `jslint.mjs` in CommonJS environment:](#to-import-jslintmjs-in-commonjs-environment)
|
|
@@ -35,16 +35,19 @@ Douglas Crockford <douglas@crockford.com>
|
|
|
35
35
|
- [To create V8 coverage report from Node.js / Npm program in shell:](#to-create-v8-coverage-report-from-nodejs--npm-program-in-shell)
|
|
36
36
|
- [To create V8 coverage report from Node.js / Npm program in javascript:](#to-create-v8-coverage-report-from-nodejs--npm-program-in-javascript)
|
|
37
37
|
|
|
38
|
-
7. [Quickstart JSLint in
|
|
39
|
-
- [To run JSLint in Vim:](#to-run-jslint-in-vim)
|
|
38
|
+
7. [Quickstart JSLint in CodeMirror](#quickstart-jslint-in-codemirror)
|
|
40
39
|
|
|
41
|
-
8. [
|
|
40
|
+
8. [Quickstart JSLint in Vim](#quickstart-jslint-in-vim)
|
|
42
41
|
|
|
43
|
-
9. [
|
|
42
|
+
9. [Quickstart JSLint in VSCode](#quickstart-jslint-in-vscode)
|
|
44
43
|
|
|
45
|
-
10. [
|
|
44
|
+
10. [Description](#description)
|
|
46
45
|
|
|
47
|
-
11. [
|
|
46
|
+
11. [Package Listing](#package-listing)
|
|
47
|
+
|
|
48
|
+
12. [Changelog](#changelog)
|
|
49
|
+
|
|
50
|
+
13. [License](#license)
|
|
48
51
|
|
|
49
52
|
|
|
50
53
|
<br><br>
|
|
@@ -73,7 +76,7 @@ Douglas Crockford <douglas@crockford.com>
|
|
|
73
76
|
|
|
74
77
|
|
|
75
78
|
<br><br>
|
|
76
|
-
### To install, just download https://www.jslint.com/jslint.mjs
|
|
79
|
+
### To install, just download and save https://www.jslint.com/jslint.mjs to file:
|
|
77
80
|
```shell <!-- shRunWithScreenshotTxt .artifact/screenshot_sh_install_download.svg -->
|
|
78
81
|
#!/bin/sh
|
|
79
82
|
|
|
@@ -81,7 +84,7 @@ curl -L https://www.jslint.com/jslint.mjs > jslint.mjs
|
|
|
81
84
|
```
|
|
82
85
|
- shell output
|
|
83
86
|
|
|
84
|
-

|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
<br><br>
|
|
@@ -95,7 +98,7 @@ node jslint.mjs hello.js
|
|
|
95
98
|
```
|
|
96
99
|
- shell output
|
|
97
100
|
|
|
98
|
-

|
|
99
102
|
|
|
100
103
|
|
|
101
104
|
<br><br>
|
|
@@ -129,7 +132,7 @@ result.warnings.forEach(function ({
|
|
|
129
132
|
```
|
|
130
133
|
- shell output
|
|
131
134
|
|
|
132
|
-

|
|
133
136
|
|
|
134
137
|
|
|
135
138
|
<br><br>
|
|
@@ -166,7 +169,7 @@ node --eval '
|
|
|
166
169
|
```
|
|
167
170
|
- shell output
|
|
168
171
|
|
|
169
|
-

|
|
170
173
|
|
|
171
174
|
|
|
172
175
|
<br><br>
|
|
@@ -180,7 +183,7 @@ node jslint.mjs .
|
|
|
180
183
|
```
|
|
181
184
|
- shell output
|
|
182
185
|
|
|
183
|
-

|
|
184
187
|
|
|
185
188
|
|
|
186
189
|
<br><br>
|
|
@@ -202,11 +205,11 @@ node jslint.mjs \
|
|
|
202
205
|
```
|
|
203
206
|
- shell output
|
|
204
207
|
|
|
205
|
-

|
|
206
209
|
|
|
207
210
|
- screenshot file [.artifact/jslint_report_hello.html](https://jslint-org.github.io/jslint/branch-beta/.artifact/jslint_report_hello.html)
|
|
208
211
|
|
|
209
|
-
[](https://jslint-org.github.io/jslint/branch-beta/.artifact/jslint_report_hello.html)
|
|
210
213
|
|
|
211
214
|
|
|
212
215
|
<br><br>
|
|
@@ -220,17 +223,17 @@ node --input-type=module --eval '
|
|
|
220
223
|
import jslint from "./jslint.mjs";
|
|
221
224
|
import fs from "fs";
|
|
222
225
|
(async function () {
|
|
223
|
-
let report;
|
|
224
226
|
let result;
|
|
225
227
|
let source = "function foo() {console.log(\u0027hello world\u0027);}\n";
|
|
226
228
|
|
|
227
229
|
// Create JSLint report from <source> in javascript.
|
|
228
230
|
|
|
229
231
|
result = jslint.jslint(source);
|
|
230
|
-
|
|
232
|
+
result = jslint.jslint_report(result);
|
|
233
|
+
result = `<body class="JSLINT_ JSLINT_REPORT_">\n${result}</body>\n`;
|
|
231
234
|
|
|
232
235
|
await fs.promises.mkdir(".artifact/", {recursive: true});
|
|
233
|
-
await fs.promises.writeFile(".artifact/jslint_report_hello.html",
|
|
236
|
+
await fs.promises.writeFile(".artifact/jslint_report_hello.html", result);
|
|
234
237
|
console.error("wrote file .artifact/jslint_report_hello.html");
|
|
235
238
|
}());
|
|
236
239
|
|
|
@@ -238,11 +241,11 @@ import fs from "fs";
|
|
|
238
241
|
```
|
|
239
242
|
- shell output
|
|
240
243
|
|
|
241
|
-

|
|
242
245
|
|
|
243
246
|
- screenshot file [.artifact/jslint_report_hello.html](https://jslint-org.github.io/jslint/branch-beta/.artifact/jslint_report_hello.html)
|
|
244
247
|
|
|
245
|
-
[](https://jslint-org.github.io/jslint/branch-beta/.artifact/jslint_report_hello.html)
|
|
246
249
|
|
|
247
250
|
|
|
248
251
|
<br><br>
|
|
@@ -266,22 +269,36 @@ npm install
|
|
|
266
269
|
|
|
267
270
|
node ../jslint.mjs \
|
|
268
271
|
v8_coverage_report=../.artifact/coverage_sqlite3_sh/ \
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
+
--exclude=tes?/ \
|
|
273
|
+
--exclude=tes[!0-9A-Z_a-z-]/ \
|
|
274
|
+
--exclude=tes[0-9A-Z_a-z-]/ \
|
|
275
|
+
--exclude=tes[^0-9A-Z_a-z-]/ \
|
|
276
|
+
--exclude=test/**/*.js \
|
|
277
|
+
--exclude=test/suppor*/*elper.js \
|
|
278
|
+
--exclude=test/suppor?/?elper.js \
|
|
279
|
+
--exclude=test/support/helper.js \
|
|
280
|
+
--include=**/*.cjs \
|
|
281
|
+
--include=**/*.js \
|
|
282
|
+
--include=**/*.mjs \
|
|
283
|
+
--include=li*/*.js \
|
|
284
|
+
--include=li?/*.js \
|
|
285
|
+
--include=lib/ \
|
|
286
|
+
--include=lib/**/*.js \
|
|
287
|
+
--include=lib/*.js \
|
|
288
|
+
--include=lib/sqlite3.js \
|
|
272
289
|
npm run test
|
|
273
290
|
```
|
|
274
291
|
- shell output
|
|
275
292
|
|
|
276
|
-

|
|
277
294
|
|
|
278
295
|
- screenshot file [.artifact/coverage_sqlite3_sh/index.html](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage_sqlite3_sh/index.html)
|
|
279
296
|
|
|
280
|
-
[](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage_sqlite3_sh/index.html)
|
|
281
298
|
|
|
282
299
|
- screenshot file [.artifact/coverage_sqlite3_sh/lib/sqlite3.js.html](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage_sqlite3_sh/lib/sqlite3.js.html)
|
|
283
300
|
|
|
284
|
-
[](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage_sqlite3_sh/lib/sqlite3.js.html)
|
|
285
302
|
|
|
286
303
|
|
|
287
304
|
<br><br>
|
|
@@ -308,8 +325,23 @@ import jslint from "../jslint.mjs";
|
|
|
308
325
|
await jslint.v8CoverageReportCreate({
|
|
309
326
|
coverageDir: "../.artifact/coverage_sqlite3_js/",
|
|
310
327
|
processArgv: [
|
|
311
|
-
"--
|
|
312
|
-
"--
|
|
328
|
+
"--exclude=tes?/",
|
|
329
|
+
"--exclude=tes[!0-9A-Z_a-z-]/",
|
|
330
|
+
"--exclude=tes[0-9A-Z_a-z-]/",
|
|
331
|
+
"--exclude=tes[^0-9A-Z_a-z-]/",
|
|
332
|
+
"--exclude=test/**/*.js",
|
|
333
|
+
"--exclude=test/suppor*/*elper.js",
|
|
334
|
+
"--exclude=test/suppor?/?elper.js",
|
|
335
|
+
"--exclude=test/support/helper.js",
|
|
336
|
+
"--include=**/*.cjs",
|
|
337
|
+
"--include=**/*.js",
|
|
338
|
+
"--include=**/*.mjs",
|
|
339
|
+
"--include=li*/*.js",
|
|
340
|
+
"--include=li?/*.js",
|
|
341
|
+
"--include=lib/",
|
|
342
|
+
"--include=lib/**/*.js",
|
|
343
|
+
"--include=lib/*.js",
|
|
344
|
+
"--include=lib/sqlite3.js",
|
|
313
345
|
"npm", "run", "test"
|
|
314
346
|
]
|
|
315
347
|
});
|
|
@@ -319,23 +351,133 @@ import jslint from "../jslint.mjs";
|
|
|
319
351
|
```
|
|
320
352
|
- shell output
|
|
321
353
|
|
|
322
|
-

|
|
323
355
|
|
|
324
356
|
- screenshot file [.artifact/coverage_sqlite3_js/index.html](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage_sqlite3_js/index.html)
|
|
325
357
|
|
|
326
|
-
[](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage_sqlite3_js/index.html)
|
|
327
359
|
|
|
328
360
|
- screenshot file [.artifact/coverage_sqlite3_js/lib/sqlite3.js.html](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage_sqlite3_js/lib/sqlite3.js.html)
|
|
329
361
|
|
|
330
|
-
[](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage_sqlite3_js/lib/sqlite3.js.html)
|
|
331
363
|
|
|
332
364
|
|
|
333
365
|
<br><br>
|
|
334
|
-
# Quickstart JSLint in
|
|
366
|
+
# Quickstart JSLint in CodeMirror
|
|
367
|
+
1. Download and save [`jslint.mjs`](https://www.jslint.com/jslint.mjs), [`jslint_wrapper_codemirror.js`](https://www.jslint.com/jslint_wrapper_codemirror.js) to file.
|
|
368
|
+
|
|
369
|
+
2. Edit, save, and serve example html-file below:
|
|
370
|
+
```html <!-- jslint_wrapper_codemirror.html -->
|
|
371
|
+
<!DOCTYPE html>
|
|
372
|
+
<html lang="en">
|
|
373
|
+
<head>
|
|
374
|
+
<meta charset="utf-8">
|
|
375
|
+
<title>CodeMirror: JSLint Demo</title>
|
|
376
|
+
|
|
377
|
+
<!-- Assets from codemirror. -->
|
|
378
|
+
|
|
379
|
+
<link rel="stylesheet" href="https://codemirror.net/lib/codemirror.css">
|
|
380
|
+
<link rel="stylesheet" href="https://codemirror.net/addon/lint/lint.css">
|
|
381
|
+
<script defer src="https://codemirror.net/lib/codemirror.js"></script>
|
|
382
|
+
<script defer
|
|
383
|
+
src="https://codemirror.net/mode/javascript/javascript.js"></script>
|
|
384
|
+
<script defer src="https://codemirror.net/addon/lint/lint.js"></script>
|
|
385
|
+
|
|
386
|
+
<!-- Assets from jslint. -->
|
|
387
|
+
|
|
388
|
+
<script type="module" src="./jslint.mjs?window_jslint=1"></script>
|
|
389
|
+
<script defer src="./jslint_wrapper_codemirror.js"></script>
|
|
390
|
+
<style>
|
|
391
|
+
body {
|
|
392
|
+
background: #bbb;
|
|
393
|
+
color: #333;
|
|
394
|
+
font-family: sans-serif;
|
|
395
|
+
margin: 20px;
|
|
396
|
+
}
|
|
397
|
+
.JSLINT_.JSLINT_REPORT_ {
|
|
398
|
+
margin-top: 20px;
|
|
399
|
+
}
|
|
400
|
+
</style>
|
|
401
|
+
</head>
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
<body>
|
|
405
|
+
<h1>CodeMirror: JSLint Demo</h1>
|
|
406
|
+
<h3>
|
|
407
|
+
This demo will auto-lint the code below, and auto-generate a report as you type.
|
|
408
|
+
</h3>
|
|
409
|
+
|
|
410
|
+
<!-- Container for codemirror-editor. -->
|
|
411
|
+
|
|
412
|
+
<textarea id="editor1">console.log('hello world');</textarea>
|
|
413
|
+
|
|
414
|
+
<!-- Container for jslint-report. -->
|
|
415
|
+
|
|
416
|
+
<div class="JSLINT_ JSLINT_REPORT_"></div>
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
<script type=module>
|
|
420
|
+
window.addEventListener("load", function () {
|
|
421
|
+
let editor = window.CodeMirror.fromTextArea(document.getElementById(
|
|
422
|
+
"editor1"
|
|
423
|
+
), {
|
|
424
|
+
gutters: [
|
|
425
|
+
"CodeMirror-lint-markers"
|
|
426
|
+
],
|
|
427
|
+
indentUnit: 4,
|
|
428
|
+
lineNumbers: true,
|
|
429
|
+
lint: {
|
|
430
|
+
lintOnChange: true, // Enable auto-lint.
|
|
431
|
+
options: {
|
|
432
|
+
// browser: true,
|
|
433
|
+
// node: true
|
|
434
|
+
globals: [
|
|
435
|
+
// "caches",
|
|
436
|
+
// "indexedDb"
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
mode: "javascript"
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// Initialize event-handling before linter is run.
|
|
444
|
+
|
|
445
|
+
editor.on("lintJslintBefore", function (/* options */) {
|
|
446
|
+
// options.browser = true;
|
|
447
|
+
// options.node = true;
|
|
448
|
+
// options.globals = [
|
|
449
|
+
// "caches",
|
|
450
|
+
// "indexedDb"
|
|
451
|
+
// ];
|
|
452
|
+
return;
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
// Initialize event-handling after linter is run.
|
|
456
|
+
|
|
457
|
+
editor.on("lintJslintAfter", function (options) {
|
|
458
|
+
|
|
459
|
+
// Generate jslint-report from options.result.
|
|
460
|
+
|
|
461
|
+
document.querySelector(
|
|
462
|
+
".JSLINT_REPORT_"
|
|
463
|
+
).innerHTML = window.jslint.jslint_report(options.result);
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// Manually trigger linter.
|
|
467
|
+
|
|
468
|
+
editor.performLint();
|
|
469
|
+
});
|
|
470
|
+
</script>
|
|
471
|
+
</body>
|
|
472
|
+
</html>
|
|
473
|
+
```
|
|
474
|
+
3. Live example at https://www.jslint.com/jslint_wrapper_codemirror.html
|
|
475
|
+
|
|
476
|
+
[](https://jslint-org.github.io/jslint/jslint_wrapper_codemirror.html)
|
|
335
477
|
|
|
336
478
|
|
|
337
479
|
<br><br>
|
|
338
|
-
|
|
480
|
+
# Quickstart JSLint in Vim
|
|
339
481
|
1. Download and save [`jslint.mjs`](https://www.jslint.com/jslint.mjs), [`jslint_wrapper_vim.vim`](https://www.jslint.com/jslint_wrapper_vim.vim) to directory `~/.vim/`
|
|
340
482
|
2. Add vim-command `:source ~/.vim/jslint_wrapper_vim.vim` to file `~/.vimrc`
|
|
341
483
|
3. Vim can now jslint files (via nodejs):
|
|
@@ -343,7 +485,19 @@ import jslint from "../jslint.mjs";
|
|
|
343
485
|
- with vim-key-combo `<Ctrl-S> <Ctrl-J>`
|
|
344
486
|
- screenshot
|
|
345
487
|
|
|
346
|
-
](https://www.jslint.com/jslint_wrapper_vim.vim)
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
<br><br>
|
|
492
|
+
# Quickstart JSLint in VSCode
|
|
493
|
+
1. In VSCode, search and install extension [`vscode-jslint`](https://marketplace.visualstudio.com/items?itemName=jslint.vscode-jslint)
|
|
494
|
+
2. In VSCode, while editing a javascript file:
|
|
495
|
+
- right-click context-menu and select `[JSLint - Lint File]`
|
|
496
|
+
- or use key-binding `[Ctrl + Shift + J], [L]`
|
|
497
|
+
- or use key-binding `[ Cmd + Shift + J], [L]` for Mac
|
|
498
|
+
- screenshot
|
|
499
|
+
|
|
500
|
+
[](https://marketplace.visualstudio.com/items?itemName=jslint.vscode-jslint)
|
|
347
501
|
|
|
348
502
|
|
|
349
503
|
<br><br>
|