Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Add linting to git commit #11556

Merged
merged 6 commits into from Apr 24, 2019
Merged
Changes from 4 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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"

This comment has been minimized.

Copy link
@platinumazure

platinumazure Mar 28, 2019

Member

Just to make sure I understand: We need git add in the *.js section because eslint --fix might make changes, so we need to stage those; but we don't need it here, because markdownlint doesn't autofix, but rather only reports errors.

Have I got that right?

},
"files": [
"LICENSE",
"README.md",
@@ -99,6 +109,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.12.0",
"mocha": "^5.0.5",
@@ -112,7 +123,8 @@
"temp": "^0.9.0",
"through": "^2.3.8",
"webpack": "^4.29.3",
"webpack-cli": "^3.2.3"
"webpack-cli": "^3.2.3",
"yorkie": "^2.0.0"
This conversation was marked as resolved by aladdin-add

This comment has been minimized.

Copy link
@aladdin-add

aladdin-add Mar 27, 2019

Member

we can consider using husky -- it seems to be more popular?

(I'm not very familar with yorkie (o|o)

This comment has been minimized.

Copy link
@g-plane

g-plane Mar 27, 2019

Member

yorkie is just a fork of husky.

This comment has been minimized.

Copy link
@nzakas

nzakas Mar 27, 2019

Author Member

yorkie takes care of some of the problems husky has with resolving the correct location of package.json (Vue uses yorkie).

},
"keywords": [
"ast",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.