Merge pull request #90 from netlify/enforce-code-style
Enforces code style
This commit is contained in:
commit
de5958752a
20
.editorconfig
Normal file
20
.editorconfig
Normal file
@ -0,0 +1,20 @@
|
||||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.js]
|
||||
quote_type = single
|
||||
spaces_around_operators = true
|
||||
|
||||
[*.css]
|
||||
quote_type = single
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
125
.eslintrc
125
.eslintrc
@ -1,113 +1,12 @@
|
||||
env:
|
||||
browser: true
|
||||
es6: true
|
||||
|
||||
parser: babel-eslint
|
||||
plugins: [
|
||||
"react",
|
||||
"class-property"
|
||||
]
|
||||
|
||||
rules:
|
||||
# Possible Errors
|
||||
# https://github.com/eslint/eslint/tree/master/docs/rules#possible-errors
|
||||
no-control-regex: 2
|
||||
no-debugger: 2
|
||||
no-dupe-args: 2
|
||||
no-dupe-keys: 2
|
||||
no-duplicate-case: 2
|
||||
no-empty-character-class: 2
|
||||
no-ex-assign: 2
|
||||
no-extra-boolean-cast : 2
|
||||
no-extra-semi: 2
|
||||
no-invalid-regexp: 2
|
||||
no-irregular-whitespace: 2
|
||||
no-proto: 2
|
||||
no-unexpected-multiline: 2
|
||||
no-unreachable: 2
|
||||
valid-typeof: 2
|
||||
|
||||
# Best Practices
|
||||
# https://github.com/eslint/eslint/tree/master/docs/rules#best-practices
|
||||
no-fallthrough: 2
|
||||
no-redeclare: 2
|
||||
no-constant-condition: 2
|
||||
|
||||
# Stylistic Issues
|
||||
# https://github.com/eslint/eslint/tree/master/docs/rules#stylistic-issues
|
||||
comma-spacing: 2
|
||||
eol-last: 2
|
||||
indent: [2, 2, {SwitchCase: 1}]
|
||||
max-len: [2, 160, 2]
|
||||
new-parens: 2
|
||||
no-mixed-spaces-and-tabs: 2
|
||||
no-multiple-empty-lines: [2, {max: 2}]
|
||||
no-trailing-spaces: 2
|
||||
object-curly-spacing: [1, "always"]
|
||||
quotes: [2, "single", "avoid-escape"]
|
||||
semi: 2
|
||||
keyword-spacing: 2
|
||||
space-before-blocks: [2, "always"]
|
||||
space-before-function-paren: [2, "never"]
|
||||
space-in-parens: [2, "never"]
|
||||
space-infix-ops: 2
|
||||
space-unary-ops: 2
|
||||
|
||||
# ECMAScript 6
|
||||
# http://eslint.org/docs/rules/#ecmascript-6
|
||||
arrow-spacing: [2, {"before": true, "after": true}]
|
||||
no-confusing-arrow: 2
|
||||
prefer-const: 2
|
||||
|
||||
# Strict Mode
|
||||
# https://github.com/eslint/eslint/tree/master/docs/rules#strict-mode
|
||||
strict: [2, "global"]
|
||||
|
||||
# Variables
|
||||
# https://github.com/eslint/eslint/tree/master/docs/rules#variables
|
||||
no-undef: 2
|
||||
no-unused-vars: [2, {"args": "none"}]
|
||||
|
||||
|
||||
react/prop-types: 1
|
||||
react/forbid-prop-types: 1
|
||||
react/jsx-boolean-value: 1
|
||||
react/jsx-closing-bracket-location: 1
|
||||
react/jsx-curly-spacing: 1
|
||||
react/jsx-equals-spacing: 1
|
||||
react/jsx-handler-names: 1
|
||||
react/jsx-indent-props: 1
|
||||
react/jsx-indent: [2, 2]
|
||||
react/jsx-no-bind: 1
|
||||
react/jsx-no-duplicate-props: 1
|
||||
react/jsx-no-undef: 1
|
||||
react/jsx-pascal-case: 1
|
||||
react/jsx-uses-react: 1
|
||||
react/jsx-uses-vars: 1
|
||||
react/no-danger: 1
|
||||
react/no-deprecated: 1
|
||||
react/no-did-mount-set-state: 1
|
||||
react/no-did-update-set-state: 1
|
||||
react/no-direct-mutation-state: 1
|
||||
react/no-is-mounted: 1
|
||||
react/no-multi-comp: 1
|
||||
react/no-string-refs: 1
|
||||
react/no-unknown-property: 1
|
||||
react/prefer-es6-class: 1
|
||||
react/prefer-stateless-function: 1
|
||||
react/react-in-jsx-scope: 1
|
||||
react/require-extension: 1
|
||||
react/self-closing-comp: 1
|
||||
react/sort-comp: 1
|
||||
|
||||
class-property/class-property-semicolon: 2
|
||||
|
||||
# Global scoped method and vars
|
||||
globals:
|
||||
netlify: true
|
||||
describe: true
|
||||
it: true
|
||||
require: true
|
||||
process: true
|
||||
module: true
|
||||
CMS_ENV: true
|
||||
{
|
||||
"extends": [
|
||||
"eslint-config-netlify"
|
||||
],
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"webpack": {
|
||||
"config": "webpack.dev.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
270
.stylelintrc
Normal file
270
.stylelintrc
Normal file
@ -0,0 +1,270 @@
|
||||
{
|
||||
"extends": [
|
||||
"stylelint-config-standard",
|
||||
"stylelint-config-css-modules"
|
||||
],
|
||||
"plugins": [
|
||||
"stylelint-declaration-block-order",
|
||||
"stylelint-declaration-use-variable"
|
||||
],
|
||||
"rules": {
|
||||
"at-rule-no-vendor-prefix": true,
|
||||
"comment-empty-line-before": "never",
|
||||
"declaration-no-important": true,
|
||||
"function-url-no-scheme-relative": true,
|
||||
"function-url-quotes": "always",
|
||||
"max-nesting-depth": 1,
|
||||
"media-feature-name-no-vendor-prefix": true,
|
||||
"number-leading-zero": "never",
|
||||
"number-max-precision": 3,
|
||||
"property-no-vendor-prefix": true,
|
||||
"selector-attribute-quotes": "always",
|
||||
"selector-no-attribute": true,
|
||||
"selector-no-qualifying-type": true,
|
||||
"selector-no-id": true,
|
||||
"selector-no-type": true,
|
||||
"selector-no-universal": true,
|
||||
"selector-no-vendor-prefix": true,
|
||||
"selector-pseudo-element-colon-notation": "double",
|
||||
"selector-pseudo-element-no-unknown": true,
|
||||
"selector-root-no-composition": true,
|
||||
"selector-type-no-unknown": true,
|
||||
"string-quotes": "single",
|
||||
"value-no-vendor-prefix": true,
|
||||
"stylelint-disable-reason": "always-after",
|
||||
|
||||
"declaration-block-properties-order": [
|
||||
[
|
||||
"composes",
|
||||
"position",
|
||||
"top",
|
||||
"right",
|
||||
"bottom",
|
||||
"left",
|
||||
"z-index",
|
||||
"display",
|
||||
"visibility",
|
||||
"flex",
|
||||
"flex-grow",
|
||||
"flex-shrink",
|
||||
"flex-basis",
|
||||
"flex-direction",
|
||||
"flex-flow",
|
||||
"flex-wrap",
|
||||
"align-content",
|
||||
"align-items",
|
||||
"align-self",
|
||||
"justify-content",
|
||||
"order",
|
||||
"float",
|
||||
"clear",
|
||||
"overflow",
|
||||
"overflow-x",
|
||||
"overflow-y",
|
||||
"-webkit-overflow-scrolling",
|
||||
"clip",
|
||||
"box-sizing",
|
||||
"margin",
|
||||
"margin-top",
|
||||
"margin-right",
|
||||
"margin-bottom",
|
||||
"margin-left",
|
||||
"padding",
|
||||
"padding-top",
|
||||
"padding-right",
|
||||
"padding-bottom",
|
||||
"padding-left",
|
||||
"min-width",
|
||||
"min-height",
|
||||
"max-width",
|
||||
"max-height",
|
||||
"width",
|
||||
"height",
|
||||
"outline",
|
||||
"outline-width",
|
||||
"outline-style",
|
||||
"outline-color",
|
||||
"outline-offset",
|
||||
"border",
|
||||
"border-spacing",
|
||||
"border-collapse",
|
||||
"border-width",
|
||||
"border-style",
|
||||
"border-color",
|
||||
"border-top",
|
||||
"border-top-width",
|
||||
"border-top-style",
|
||||
"border-top-color",
|
||||
"border-right",
|
||||
"border-right-width",
|
||||
"border-right-style",
|
||||
"border-right-color",
|
||||
"border-bottom",
|
||||
"border-bottom-width",
|
||||
"border-bottom-style",
|
||||
"border-bottom-color",
|
||||
"border-left",
|
||||
"border-left-width",
|
||||
"border-left-style",
|
||||
"border-left-color",
|
||||
"border-radius",
|
||||
"border-top-left-radius",
|
||||
"border-top-right-radius",
|
||||
"border-bottom-right-radius",
|
||||
"border-bottom-left-radius",
|
||||
"border-image",
|
||||
"border-image-source",
|
||||
"border-image-slice",
|
||||
"border-image-width",
|
||||
"border-image-outset",
|
||||
"border-image-repeat",
|
||||
"border-top-image",
|
||||
"border-right-image",
|
||||
"border-bottom-image",
|
||||
"border-left-image",
|
||||
"border-corner-image",
|
||||
"border-top-left-image",
|
||||
"border-top-right-image",
|
||||
"border-bottom-right-image",
|
||||
"border-bottom-left-image",
|
||||
"background",
|
||||
"background-color",
|
||||
"background-image",
|
||||
"background-attachment",
|
||||
"background-position",
|
||||
"background-position-x",
|
||||
"background-position-y",
|
||||
"background-clip",
|
||||
"background-origin",
|
||||
"background-size",
|
||||
"background-repeat",
|
||||
"box-decoration-break",
|
||||
"box-shadow",
|
||||
"color",
|
||||
"table-layout",
|
||||
"caption-side",
|
||||
"empty-cells",
|
||||
"list-style",
|
||||
"list-style-position",
|
||||
"list-style-type",
|
||||
"list-style-image",
|
||||
"quotes",
|
||||
"content",
|
||||
"counter-increment",
|
||||
"counter-reset",
|
||||
"-ms-writing-mode",
|
||||
"vertical-align",
|
||||
"text-align",
|
||||
"text-align-last",
|
||||
"text-decoration",
|
||||
"text-emphasis",
|
||||
"text-emphasis-position",
|
||||
"text-emphasis-style",
|
||||
"text-emphasis-color",
|
||||
"text-indent",
|
||||
"text-justify",
|
||||
"text-outline",
|
||||
"text-transform",
|
||||
"text-wrap",
|
||||
"text-overflow",
|
||||
"text-overflow-ellipsis",
|
||||
"text-overflow-mode",
|
||||
"text-shadow",
|
||||
"text-rendering",
|
||||
"white-space",
|
||||
"word-spacing",
|
||||
"word-wrap",
|
||||
"word-break",
|
||||
"tab-size",
|
||||
"hyphens",
|
||||
"letter-spacing",
|
||||
"font",
|
||||
"font-weight",
|
||||
"font-style",
|
||||
"font-variant",
|
||||
"font-size-adjust",
|
||||
"font-stretch",
|
||||
"font-size",
|
||||
"font-family",
|
||||
"font-feature-settings",
|
||||
"-webkit-font-smoothing",
|
||||
"-moz-osx-font-smoothing",
|
||||
"src",
|
||||
"line-height",
|
||||
"opacity",
|
||||
"filter",
|
||||
"resize",
|
||||
"cursor",
|
||||
"nav-index",
|
||||
"nav-up",
|
||||
"nav-right",
|
||||
"nav-down",
|
||||
"nav-left",
|
||||
"transition",
|
||||
"transition-delay",
|
||||
"transition-timing-function",
|
||||
"transition-duration",
|
||||
"transition-property",
|
||||
"transform",
|
||||
"transform-origin",
|
||||
"animation",
|
||||
"animation-name",
|
||||
"animation-duration",
|
||||
"animation-play-state",
|
||||
"animation-timing-function",
|
||||
"animation-delay",
|
||||
"animation-iteration-count",
|
||||
"animation-direction",
|
||||
"animation-fill-mode",
|
||||
"pointer-events",
|
||||
"unicode-bidi",
|
||||
"direction",
|
||||
"columns",
|
||||
"column-span",
|
||||
"column-width",
|
||||
"column-count",
|
||||
"column-fill",
|
||||
"column-gap",
|
||||
"column-rule",
|
||||
"column-rule-width",
|
||||
"column-rule-style",
|
||||
"column-rule-color",
|
||||
"break-before",
|
||||
"break-inside",
|
||||
"break-after",
|
||||
"page-break-before",
|
||||
"page-break-inside",
|
||||
"page-break-after",
|
||||
"orphans",
|
||||
"widows",
|
||||
"zoom",
|
||||
"max-zoom",
|
||||
"min-zoom",
|
||||
"user-zoom",
|
||||
"orientation",
|
||||
"user-select",
|
||||
"fill",
|
||||
"stroke"
|
||||
],
|
||||
{ "unspecified": "bottomAlphabetical" }
|
||||
],
|
||||
|
||||
"plugin/declaration-block-order": [
|
||||
"custom-properties",
|
||||
"dollar-variables",
|
||||
"declarations",
|
||||
"rules",
|
||||
"at-rules"
|
||||
],
|
||||
|
||||
"sh-waqar/declaration-use-variable": [
|
||||
[
|
||||
"/color/",
|
||||
"z-index",
|
||||
"font-size",
|
||||
"border-radius",
|
||||
"/background/"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
31
package.json
31
package.json
@ -10,14 +10,24 @@
|
||||
"build": "webpack --config webpack.config.js",
|
||||
"storybook": "start-storybook -p 9001",
|
||||
"storybook-build": "build-storybook -o dist",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"lint:staged": "lint-staged"
|
||||
"lint": "npm run lint:js & npm run lint:css",
|
||||
"lint:js": "eslint .",
|
||||
"lint:js:fix": "npm run lint:js -- --fix",
|
||||
"lint:css": "stylelint 'src/**/*.css'",
|
||||
"lint:css:fix": "stylefmt --recursive src/",
|
||||
"lint:staged": "lint-staged",
|
||||
"deps": "npm-check -s",
|
||||
"deps:update": "npm-check -u"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.@(js|jsx)": [
|
||||
"*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
],
|
||||
"*.css": [
|
||||
"stylefmt",
|
||||
"stylelint",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"pre-commit": "lint:staged",
|
||||
@ -31,7 +41,6 @@
|
||||
"@kadira/storybook": "^1.36.0",
|
||||
"autoprefixer": "^6.3.3",
|
||||
"babel-core": "^6.5.1",
|
||||
"babel-eslint": "^6.1.2",
|
||||
"babel-loader": "^6.2.2",
|
||||
"babel-plugin-lodash": "^3.2.0",
|
||||
"babel-plugin-transform-class-properties": "^6.5.2",
|
||||
@ -41,9 +50,8 @@
|
||||
"babel-preset-react": "^6.5.0",
|
||||
"babel-runtime": "^6.5.0",
|
||||
"css-loader": "^0.23.1",
|
||||
"eslint": "^3.5.0",
|
||||
"eslint-plugin-class-property": "^1.0.1",
|
||||
"eslint-plugin-react": "^5.1.1",
|
||||
"eslint": "^3.7.1",
|
||||
"eslint-config-netlify": "github:netlify/netlify-eslint",
|
||||
"expect": "^1.20.2",
|
||||
"exports-loader": "^0.6.3",
|
||||
"file-loader": "^0.8.5",
|
||||
@ -55,6 +63,7 @@
|
||||
"moment": "^2.11.2",
|
||||
"node-sass": "^3.10.0",
|
||||
"normalizr": "^2.0.0",
|
||||
"npm-check": "^5.2.3",
|
||||
"postcss-cssnext": "^2.7.0",
|
||||
"postcss-import": "^8.1.2",
|
||||
"postcss-loader": "^0.9.1",
|
||||
@ -72,6 +81,12 @@
|
||||
"redux-thunk": "^1.0.3",
|
||||
"sass-loader": "^4.0.2",
|
||||
"style-loader": "^0.13.0",
|
||||
"stylefmt": "^4.3.1",
|
||||
"stylelint": "^7.3.1",
|
||||
"stylelint-config-css-modules": "^0.1.0",
|
||||
"stylelint-config-standard": "^13.0.2",
|
||||
"stylelint-declaration-block-order": "^0.1.0",
|
||||
"stylelint-declaration-use-variable": "^1.6.0",
|
||||
"url-loader": "^0.5.7",
|
||||
"webpack": "^1.13.2",
|
||||
"webpack-dev-server": "^1.15.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user