Introduced markdownlint

This commit is contained in:
Evgeniy Timokhov 2019-05-31 15:58:01 +03:00
parent 8ec2a9beac
commit 62540ba123
5 changed files with 28 additions and 16 deletions

4
.markdownlint.json Normal file
View File

@ -0,0 +1,4 @@
{
"default": true,
"line-length": false
}

View File

@ -42,6 +42,10 @@ jobs:
name: "TSLint"
script: npm run lint:tslint
- stage: *COMPILE_AND_VALIDATE_STAGE
name: "Markdownlint"
script: npm run lint:md
- stage: *TESTS_STAGE
name: "Unittests"
script: npm run test

View File

@ -38,7 +38,7 @@ lineSeries.setData([
You can use [unpkg](https://unpkg.com/):
https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js
<https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js>
The standalone version puts all exports from `esm` version to `window.LightweightCharts`:
@ -92,9 +92,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
You may obtain a copy of the License at LICENSE file.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This software incorporates several parts of tslib (https://github.com/Microsoft/tslib, (c) Microsoft Corporation) that are covered by the the Apache License, Version 2.0.
This software incorporates several parts of tslib (<https://github.com/Microsoft/tslib>, (c) Microsoft Corporation) that are covered by the the Apache License, Version 2.0.
This license requires specifying TradingView as the product creator. You can use one of the following methods to do it:
- do not disable the TradingView branding displaying;
- add the "attribution notice" from the NOTICE file and a link to our website (https://www.tradingview.com/) to the page of your website or mobile application that is available to your users;
- add the "attribution notice" from the NOTICE file and a link to our website (<https://www.tradingview.com/>) to the page of your website or mobile application that is available to your users;

View File

@ -35,6 +35,7 @@
"clean-publish": "~1.1.2",
"dts-bundle-generator": "~3.1.0",
"eslint": "5.16.0",
"markdownlint-cli": "~0.16.0",
"mocha": "~6.1.4",
"npm-run-all": "~4.1.5",
"rimraf": "~2.6.3",
@ -62,6 +63,7 @@
"lint": "npm-run-all -p lint:**",
"lint:eslint": "eslint --format=unix --ext .js ./",
"lint:tslint": "tslint --config tslint.json --project tsconfig.all-non-composite.json",
"lint:md": "./node_modules/.bin/markdownlint -i \"**/node_modules/**\" \"**/*.md\"",
"rollup": "rollup -c rollup.config.js",
"build": "npm-run-all tsc rollup bundle-dts",
"verify": "npm-run-all clean tsc-all lint build test",

View File

@ -54,30 +54,29 @@ function shellEscape(arg) {
}"`;
}
function runTSLintForFiles(tsFiles) {
if (tsFiles.length === 0) {
function runForFiles(cmd, files) {
if (files.length === 0) {
return false;
}
let cmd = 'node ./node_modules/tslint/bin/tslint --config tslint.json ';
for (const file of tsFiles) {
cmd += ' ';
for (const file of files) {
cmd += `${shellEscape(file)} `;
}
return run(cmd);
}
function runTSLintForFiles(tsFiles) {
return runForFiles('node ./node_modules/tslint/bin/tslint --config tslint.json', tsFiles);
}
function runESLintForFiles(jsFiles) {
if (jsFiles.length === 0) {
return false;
}
return runForFiles('node ./node_modules/eslint/bin/eslint --quiet --format=unix', jsFiles);
}
let cmd = 'node ./node_modules/eslint/bin/eslint --quiet --format=unix ';
for (const file of jsFiles) {
cmd += `${shellEscape(file)} `;
}
return run(cmd);
function runMarkdownLintForFiles(mdFiles) {
return runForFiles('node ./node_modules/markdownlint-cli/markdownlint.js', mdFiles);
}
function filterByExt(files, ext) {
@ -101,6 +100,9 @@ function lintFiles(files) {
hasErrors = runTSLintForFiles(tsFiles) || hasErrors;
}
// markdown
hasErrors = runMarkdownLintForFiles(filterByExt(files, '.md')) || hasErrors;
return hasErrors;
}