Switch linting to ESLint and Prettier #191

Merged
BehindTheMath merged 4 commits from feature/eslint-and-prettier into master 2019-02-13 22:26:57 -05:00
6 changed files with 34 additions and 144 deletions
Showing only changes of commit 98f54e164f - Show all commits

4
.eslintignore Normal file
View File

@@ -0,0 +1,4 @@
MoOx commented 2019-01-02 12:13:28 -05:00 (Migrated from github.com)
Review

No need for this. In
https://eslint.org/docs/user-guide/configuring#eslintignore
you can read

/node_modules/* and /bower_components/* in the project root are ignored by default

I think it's the same for prettier.

Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)

No need for this. In https://eslint.org/docs/user-guide/configuring#eslintignore you can read > # /node_modules/* and /bower_components/* in the project root are ignored by default I think it's the same for prettier. Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)
MoOx commented 2019-01-02 12:13:28 -05:00 (Migrated from github.com)
Review

No need for this. In
https://eslint.org/docs/user-guide/configuring#eslintignore
you can read

/node_modules/* and /bower_components/* in the project root are ignored by default

I think it's the same for prettier.

Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)

No need for this. In https://eslint.org/docs/user-guide/configuring#eslintignore you can read > # /node_modules/* and /bower_components/* in the project root are ignored by default I think it's the same for prettier. Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)
pjax.js
MoOx commented 2019-01-02 12:13:28 -05:00 (Migrated from github.com)
Review

No need for this. In
https://eslint.org/docs/user-guide/configuring#eslintignore
you can read

/node_modules/* and /bower_components/* in the project root are ignored by default

I think it's the same for prettier.

Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)

No need for this. In https://eslint.org/docs/user-guide/configuring#eslintignore you can read > # /node_modules/* and /bower_components/* in the project root are ignored by default I think it's the same for prettier. Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)
node_modules/**
MoOx commented 2019-01-02 12:13:28 -05:00 (Migrated from github.com)
Review

No need for this. In
https://eslint.org/docs/user-guide/configuring#eslintignore
you can read

/node_modules/* and /bower_components/* in the project root are ignored by default

I think it's the same for prettier.

Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)

No need for this. In https://eslint.org/docs/user-guide/configuring#eslintignore you can read > # /node_modules/* and /bower_components/* in the project root are ignored by default I think it's the same for prettier. Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)
pjax.min.js
MoOx commented 2019-01-02 12:13:28 -05:00 (Migrated from github.com)
Review

No need for this. In
https://eslint.org/docs/user-guide/configuring#eslintignore
you can read

/node_modules/* and /bower_components/* in the project root are ignored by default

I think it's the same for prettier.

Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)

No need for this. In https://eslint.org/docs/user-guide/configuring#eslintignore you can read > # /node_modules/* and /bower_components/* in the project root are ignored by default I think it's the same for prettier. Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)
*.json
MoOx commented 2019-01-02 12:13:28 -05:00 (Migrated from github.com)
Review

No need for this. In
https://eslint.org/docs/user-guide/configuring#eslintignore
you can read

/node_modules/* and /bower_components/* in the project root are ignored by default

I think it's the same for prettier.

Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)

No need for this. In https://eslint.org/docs/user-guide/configuring#eslintignore you can read > # /node_modules/* and /bower_components/* in the project root are ignored by default I think it's the same for prettier. Something I do sometimes is to symlink this *ignore to .gitignore (eg: that's what I do here https://github.com/MoOx/eslint-config-i-am-meticulous)

8
.eslintrc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"extends": ["eslint-config-i-am-meticulous/es5"],
"rules": {
"import/order": "off",
"import/max-dependencies": "off",
"import/extensions": ["error", "never"]
}
}

132
.jscsrc
View File

@@ -1,132 +0,0 @@
{
"excludeFiles": [
"node_modules/**",
"pjax.js",
"pjax.min.js"
],
"fileExtensions": [
".js"
],
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowMultipleVarDecl": true,
"requireBlocksOnNewline": 1,
"disallowPaddingNewlinesInBlocks": true,
"disallowEmptyBlocks": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowQuotedKeysInObjects": "allButReserved",
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"disallowSpaceAfterPrefixUnaryOperators": [
"++",
"--",
"+",
"-",
"~",
"!"
],
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"requireSpaceBeforeBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"disallowImplicitTypeConversion": [
"numeric",
"boolean",
"binary",
"string"
],
"requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties",
"disallowKeywords": [
"with"
],
"disallowMultipleLineStrings": true,
"validateQuoteMarks": "\"",
"validateIndentation": 2,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"requireKeywordsOnNewLine": [
"else"
],
"requireLineFeedAtFileEnd": true,
"requireCapitalizedConstructors": true,
"safeContextKeyword": "that",
"requireDotNotation": true,
"jsDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
},
"requireSpaceAfterLineComment": true
}

View File

@@ -1,9 +0,0 @@
{
"newcap": false,
"undef": true,
"unused": true,
"asi": true,
"esnext": true,
"node": true,
"browser": true
}

4
.prettierignore Normal file
View File

@@ -0,0 +1,4 @@
pjax.js
node_modules/**
pjax.min.js
*.json

View File

@@ -28,13 +28,16 @@
"types": "index.d.ts",
"devDependencies": {
"browserify": "^15.0.0",
"jscs": "^3.0.7",
"eslint": "^5.7.0",
"eslint-config-i-am-meticulous": "^11.0.0",
"husky": "^1.2.0",
"jsdom": "^11.5.1",
"jsdom-global": "^3.0.2",
"jshint": "^2.5.6",
"lint-staged": "^8.1.0",
"npmpub": "^3.1.0",
"nyc": "^11.4.1",
"opn-cli": "^3.1.0",
"prettier": "^1.14.3",
"serve": "^6.4.4",
"tap-nyc": "^1.0.3",
"tap-spec": "^4.1.1",
@@ -42,7 +45,7 @@
"uglify-js": "^3.3.8"
},
"scripts": {
"lint": "jscs . && jshint . --exclude-path .gitignore",
"lint": "eslint **/*.js",
"standalone": "browserify index.js --standalone Pjax > pjax.js",
"build": "npm run standalone && uglifyjs pjax.js -o pjax.min.js",
"build-debug": "browserify index.js --debug --standalone Pjax > pjax.js",
@@ -53,5 +56,17 @@
"example": "opn http://localhost:3000/example/ && serve -p 3000 .",
"prepublish": "npm run build",
"release": "npmpub"
},
"husky": {
"hooks": {
"pre-commit": "npm test && lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint --fix **/*.js",
"prettier --write",
"git add"
]
}
}