TODO: Besides splitting this out from previous commit, should really avoid markdown field in favor of modifying jsdoc to report wherever it lays out "prettyprint"; still probably missing some one-liners; see https://github.com/google/code-prettify; update builds to confirm new stackblur is working; add below to CHANGES; add back for eslint-plugin-jsdoc once merged (though need new version ^3.9.1); move any linting changes to other linting branch
- Refactoring (minor): Add favicon to canvas demo
- Linting (ESLint Markdown JavaScript): Add `eslint-plugin-markdown` with
slightly loosened config (`no-undef` and `padded-blocks` off and
`no-unused-vars` as a warning)
- Linting (ESLint JSDoc code comments): Add `eslint-plugin-jsdoc` and apply to
JSDoc code comments
- Linting (ESLint): Completely avoid unescaped tabs in files
- Docs (Linting): Add linting info file
- npm: Rename `copy-deps` script to `copy`
- Refactoring: Add stackblur-canvas as a dependency and copy it in (until such time as we can do so for canvg)
This commit is contained in:
29
docs/Linting.md
Normal file
29
docs/Linting.md
Normal file
@@ -0,0 +1,29 @@
|
||||
## Command line
|
||||
|
||||
```
|
||||
npm run eslint
|
||||
```
|
||||
|
||||
This will query both JavaScript files and will query JavaScript within
|
||||
Markdown files. It will also check for some JSDoc issues.
|
||||
|
||||
## JSDoc
|
||||
|
||||
To check for JSDoc issues, besides the eslint script, one may run the
|
||||
following to find any overly generic types in use (types should be as
|
||||
specific as possible):
|
||||
|
||||
```
|
||||
npm run types-doc
|
||||
```
|
||||
|
||||
See also [ReleaseInstructions](./ReleaseInstructions.md).
|
||||
|
||||
## Atom usage
|
||||
|
||||
If using the Atom package `linter-eslint`, one may add `source.gfm` to the
|
||||
"List of scopes to run ESLint on..." setting to get reporting of JavaScript
|
||||
errors in Markdown.
|
||||
|
||||
One may also add `source.embedded.js` though configuration comments
|
||||
and skip directives (not currently in use) don't seem to work there.
|
||||
@@ -4,6 +4,8 @@
|
||||
module.exports = {
|
||||
plugins: ['plugins/markdown'],
|
||||
markdown: {
|
||||
// tags: ['examples']
|
||||
/*
|
||||
// "The highlighter function should escape the code block's contents and wrap them in <pre><code> tags"
|
||||
highlight (code, language) {
|
||||
function ret () {
|
||||
@@ -11,6 +13,8 @@ module.exports = {
|
||||
return '<pre><code>' + code + ' in this language: ' + language + '</code></pre>';
|
||||
}
|
||||
if (language !== 'js') { // E.g., we have one URL in some tutorial Markdown
|
||||
// Seems to be only for full triple-backticked fences
|
||||
// console.log('lll', code);
|
||||
return ret();
|
||||
}
|
||||
|
||||
@@ -48,8 +52,8 @@ module.exports = {
|
||||
console.log('\n' + code);
|
||||
|
||||
return ret();
|
||||
},
|
||||
tags: []
|
||||
}
|
||||
*/
|
||||
},
|
||||
recurseDepth: 10,
|
||||
source: {
|
||||
@@ -69,15 +73,15 @@ module.exports = {
|
||||
},
|
||||
templates: {
|
||||
cleverLinks: true,
|
||||
monospaceLinks: false,
|
||||
monospaceLinks: false /* ,
|
||||
default: {
|
||||
layoutFile: 'docs/layout.tmpl'
|
||||
}
|
||||
} */
|
||||
},
|
||||
opts: {
|
||||
recurse: true,
|
||||
verbose: true,
|
||||
destination: 'docs/jsdoc',
|
||||
// destination: 'docs/jsdoc',
|
||||
tutorials: 'docs/tutorials'
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user