Skip to content

Commit

Permalink
Introduced markdownlint
Browse files Browse the repository at this point in the history
  • Loading branch information
timocov committed May 31, 2019
1 parent 8ec2a9b commit 62540ba
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"default": true,
"line-length": false
}
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

Expand Down Expand Up @@ -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;
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
28 changes: 15 additions & 13 deletions scripts/githooks/pre-commit/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 runESLintForFiles(jsFiles) {
if (jsFiles.length === 0) {
return false;
}
function runTSLintForFiles(tsFiles) {
return runForFiles('node ./node_modules/tslint/bin/tslint --config tslint.json', tsFiles);
}

let cmd = 'node ./node_modules/eslint/bin/eslint --quiet --format=unix ';
for (const file of jsFiles) {
cmd += `${shellEscape(file)} `;
}
function runESLintForFiles(jsFiles) {
return runForFiles('node ./node_modules/eslint/bin/eslint --quiet --format=unix', jsFiles);
}

return run(cmd);
function runMarkdownLintForFiles(mdFiles) {
return runForFiles('node ./node_modules/markdownlint-cli/markdownlint.js', mdFiles);
}

function filterByExt(files, ext) {
Expand All @@ -101,6 +100,9 @@ function lintFiles(files) {
hasErrors = runTSLintForFiles(tsFiles) || hasErrors;
}

// markdown
hasErrors = runMarkdownLintForFiles(filterByExt(files, '.md')) || hasErrors;

return hasErrors;
}

Expand Down

0 comments on commit 62540ba

Please sign in to comment.