Skip to content

Instantly share code, notes, and snippets.

@jsnanigans
Last active May 3, 2018 07:59
Show Gist options
  • Select an option

  • Save jsnanigans/6042ab9a3443565c7b366499efc9cce5 to your computer and use it in GitHub Desktop.

Select an option

Save jsnanigans/6042ab9a3443565c7b366499efc9cce5 to your computer and use it in GitHub Desktop.
LOOP: eshint, lint-scss
module.exports = {
"ecmaFeatures": {
"modules": true,
"experimentalObjectRestSpread": true
},
"env": {
"browser": false,
"es6": true,
"node": true,
"mocha": true
},
"globals": {
"document": false,
"navigator": false,
"window": false,
"$": false,
"Modernizr": false,
"angular": false,
"Image": false,
"XMLSerializer": false,
"getComputedStyle": false,
"app": false,
"Gridle": false
},
"notused": {
"handle-callback-err": [2, "^(err|error)$"],
"indent": [2, 2, {
"SwitchCase": 1
}],
"curly": [2, "multi-line"]
},
"rules": {
"accessor-pairs": 2,
"arrow-spacing": [2, {
"before": true,
"after": true
}],
"block-spacing": [2, "always"],
"brace-style": [2, "1tbs", {
"allowSingleLine": true
}],
"comma-dangle": [2, "always-multiline"],
"comma-spacing": [2, {
"before": false,
"after": true
}],
"comma-style": [2, "last"],
"constructor-super": 2,
"dot-location": [2, "property"],
"eol-last": 2,
"eqeqeq": [2, "allow-null"],
"generator-star-spacing": [2, {
"before": true,
"after": true
}],
"key-spacing": [2, {
"beforeColon": false,
"afterColon": true
}],
"keyword-spacing": [2, {
"before": true,
"after": true
}],
"new-cap": [2, {
"newIsCap": true,
"capIsNew": false
}],
"new-parens": 2,
"no-array-constructor": 2,
"no-caller": 2,
"no-class-assign": 2,
"no-cond-assign": 2,
"no-const-assign": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-delete-var": 2,
"no-dupe-args": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 2,
"no-eval": 2,
"no-ex-assign": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": [2, "functions"],
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-func-assign": 2,
"no-implied-eval": 2,
"no-inner-declarations": [2, "functions"],
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-iterator": 2,
"no-label-var": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [1, {
"max": 10
}],
"no-native-reassign": 0,
"no-negated-in-lhs": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-object": 2,
"no-new-require": 2,
"no-new-wrappers": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-proto": 0,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-return-assign": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-shadow-restricted-names": 2,
"no-spaced-func": 2,
"no-sparse-arrays": 2,
"no-this-before-super": 2,
"no-throw-literal": 2,
"no-trailing-spaces": 0,
"no-undef": 2,
"no-undef-init": 2,
"no-unexpected-multiline": 2,
"no-unneeded-ternary": [2, {
"defaultAssignment": false
}],
"no-unreachable": 2,
"no-unused-vars": [2, {
"vars": "all",
"args": "none"
}],
"no-useless-call": 0,
"no-with": 2,
"one-var": [0, {
"initialized": "never"
}],
"operator-linebreak": [0, "after", {
"overrides": {
"?": "before",
":": "before"
}
}],
"padded-blocks": [0, "never"],
"quotes": [2, "single", "avoid-escape"],
"radix": 2,
"semi": [2, "always"],
"semi-spacing": [2, {
"before": false,
"after": true
}],
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, "never"],
"space-in-parens": [2, "never"],
"space-infix-ops": 2,
"space-unary-ops": [2, {
"words": true,
"nonwords": false
}],
"spaced-comment": [0, "always", {
"markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","]
}],
"use-isnan": 2,
"valid-typeof": 2,
"wrap-iife": [2, "any"],
"yoda": [2, "never"]
}
};
options:
formatter: stylish
files:
include: '**/*.s+(a|c)ss'
rules:
# Extends
extends-before-mixins: 1
extends-before-declarations: 1
placeholder-in-extend: 0
# Mixins
mixins-before-declarations: 0
# Line Spacing
one-declaration-per-line: 0
empty-line-between-blocks: 0
single-line-per-selector: 0
# Disallows
no-attribute-selectors: 0
no-color-keywords: 0
no-color-literals: 0
no-combinators: 0
no-css-comments: 1
no-debug: 1
no-disallowed-properties: 0
no-duplicate-properties: 1
no-empty-rulesets: 1
no-extends: 0
no-ids: 1
no-important: 0
no-invalid-hex: 1
no-mergeable-selectors: 1
no-misspelled-properties: 1
no-qualifying-elements: 1
no-trailing-whitespace: 1
no-trailing-zero: 1
no-transition-all: 1
no-universal-selectors: 0
no-url-protocols: 1
no-vendor-prefixes: 0
no-warn: 1
property-units: 0
# Nesting
force-attribute-nesting: 1
force-element-nesting: 1
force-pseudo-nesting: 1
# Name Formats
class-name-format: 0
function-name-format: 0
id-name-format: 0
mixin-name-format: 0
placeholder-name-format: 0
variable-name-format: 0
# Style Guide
attribute-quotes: 1
bem-depth: 0
border-zero: 1
brace-style: 1
clean-import-paths: 1
empty-args: 0
hex-length: 1
hex-notation: 1
indentation: 0
leading-zero: 0
nesting-depth: 0
property-sort-order: 0
pseudo-element: 0
quotes: 1
shorthand-values: 1
url-quotes: 0
variable-for-property: 1
zero-unit: 1
# Inner Spacing
space-after-comma: 0
space-before-colon: 0
space-after-colon: 0
space-before-brace: 0
space-before-bang: 0
space-after-bang: 0
space-between-parens: 0
space-around-operator: 0
# Final Items
trailing-semicolon: 1
final-newline: 0
Setup:
install npm modules:
$ npm install -g eshint sass-lint
for SublimeText:
install the packages:
- SublimeLinter
- SublimeLinter-contrib-sass-lint
- SublimeLinter-contrib-eslint
for Atom:
intall the packages:
- linter-eslint
- linter-sass-lint
In your project directory add there two files:
.eslintrc.js : https://gist.github.com/jsnanigans/6042ab9a3443565c7b366499efc9cce5#file-eslintrc-js
.sass-lint.yml : https://gist.github.com/jsnanigans/6042ab9a3443565c7b366499efc9cce5#file-sass-lint-yml
Optional:
To 'fix' the files file automatically:
for SublimeText:
JavaScript
- install package: ESLint-Formatter
- add {"format_on_save": true} to your user settings if you want it to run every time you save.
for Atom:
JavaScript
- install package: eslint-fixer
- to 'fix' press > [CTRL | COMMAND] + [SHIFT] + [P] < and type in "fix"
SCSS
- install package: atom-beautify
- configure the atom-beautify > scss settings as you wish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment