Skip to content
Permalink
Browse files

Chore: Add linting to git commit (#11556)

* Chore: Add linting to git commit

* Use local ESLint

* Add support for Markdown linting

* Add markdown linting
  • Loading branch information...
nzakas authored and aladdin-add committed Apr 24, 2019
1 parent 8684f46 commit 8b4dba606f8306f8ad0a37e2174a6e3236f7ebe7
Showing with 34 additions and 24 deletions.
  1. +20 −0 .markdownlint.yml
  2. +1 −23 Makefile.js
  3. +13 −1 package.json
@@ -0,0 +1,20 @@
default: true

# Exclusions for deliberate/widespread violations
MD001: false # Header levels should only increment by one level at a time
MD002: false # First header should be a h1 header
MD007: # Unordered list indentation
indent: 4
MD012: false # Multiple consecutive blank lines
MD013: false # Line length
MD014: false # Dollar signs used before commands without showing output
MD019: false # Multiple spaces after hash on atx style header
MD021: false # Multiple spaces inside hashes on closed atx style header
MD024: false # Multiple headers with the same content
MD026: false # Trailing punctuation in header
MD029: false # Ordered list item prefix
MD030: false # Spaces after list markers
MD033: false # Allow inline HTML
MD034: false # Bare URL used
MD040: false # Fenced code blocks should have a language specified
MD041: false # First line in file should be a top level header
@@ -385,29 +385,7 @@ function getFirstVersionOfDeletion(filePath) {
* @private
*/
function lintMarkdown(files) {
const config = {
default: true,

// Exclusions for deliberate/widespread violations
MD001: false, // Header levels should only increment by one level at a time
MD002: false, // First header should be a h1 header
MD007: { // Unordered list indentation
indent: 4
},
MD012: false, // Multiple consecutive blank lines
MD013: false, // Line length
MD014: false, // Dollar signs used before commands without showing output
MD019: false, // Multiple spaces after hash on atx style header
MD021: false, // Multiple spaces inside hashes on closed atx style header
MD024: false, // Multiple headers with the same content
MD026: false, // Trailing punctuation in header
MD029: false, // Ordered list item prefix
MD030: false, // Spaces after list markers
MD033: false, // Allow inline HTML
MD034: false, // Bare URL used
MD040: false, // Fenced code blocks should have a language specified
MD041: false // First line in file should be a top level header
},
const config = yaml.safeLoad(fs.readFileSync(path.join(__dirname, "./.markdownlint.yml"), "utf8")),
result = markdownlint.sync({
files,
config,
@@ -23,6 +23,16 @@
"profile": "beefy tests/bench/bench.js --open -- -t brfs -t ./tests/bench/xform-rules.js -r espree",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.js": [
"node ./bin/eslint.js --fix",
"git add"
],
"*.md": "markdownlint"
},
"files": [
"LICENSE",
"README.md",
@@ -98,6 +108,7 @@
"karma-mocha-reporter": "^2.2.3",
"karma-webpack": "^4.0.0-rc.6",
"leche": "^2.2.3",
"lint-staged": "^8.1.5",
"load-perf": "^0.2.0",
"markdownlint": "^0.13.0",
"mocha": "^6.1.2",
@@ -111,7 +122,8 @@
"temp": "^0.9.0",
"through": "^2.3.8",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0"
"webpack-cli": "^3.3.0",
"yorkie": "^2.0.0"
},
"keywords": [
"ast",

0 comments on commit 8b4dba6

Please sign in to comment.
You can’t perform that action at this time.