Create a gist now

Instantly share code, notes, and snippets.

ITMD 361 well-formed, strict HTML style rules for use with htmllint; style rules for CSS stylelint
"root": true,
"extends": "eslint:recommended",
"env": {
"browser": true,
"jquery": true
"rules": {
"comma-dangle": ["error", "never"],
"no-console": 0,
"indent": ["error", 2],
"curly": 2,
"consistent-return": 1,
"eqeqeq": 2,
"use-isnan": 1,
"valid-typeof": 1,
"no-loop-func": 2,
"no-redeclare": 1,
"vars-on-top": 1,
"no-undef": 1,
"no-unused-vars": 1,
"camelcase": 1,
"comma-spacing": ["error", { "before": false, "after": true }],
"semi-spacing": ["error", {"before": false, "after": true}]
"root": true, // don't look further up the directory tree for any more eslint rules
"extends": "eslint:recommended", // load basic eslint rules
"env": {
"browser": true, // for browser testing
"jquery": true // with jQuery, if used
"rules": {
"comma-dangle": ["error", "never"], // no trailing commas
"no-console": 0, // allow use of console calls
"indent": ["error", 2], // indent by two spaces
"curly": 2, // always use curly braces around blocks
"consistent-return": 1, // always `return` from functions
"eqeqeq": 2, // always test for type, !== and ===
"use-isnan": 1, // require use of isNaN in comparisons
"valid-typeof": 1, // typeof compared against a valid string
"no-loop-func": 2, // no function declarations inside loops
"no-redeclare": 1, // don't allow the same variable to be declared again
"vars-on-top": 1, // declare variables at the top of function scope
"no-undef": 1, // all variables must be declared with var
"no-unused-vars": 1, // all variables must also be used
"camelcase": 1, // use camelCase names
"comma-spacing": ["error", { "before": false, "after": true }], // spaces before commas
"semi-spacing": ["error", {"before": false, "after": true}] // no spaces before semicolons
// names of npm modules to load into htmllint
"plugins": [],
// TODO: export htmllint"s default cfg
"indent-style": "spaces", // use spaces to indent
"indent-width": 2, // use two spaces, to be precise
"attr-name-style": "dash", // allow hyphens/dashes in attributes, e.g., for data- attributes
"id-class-style": "dash", // allow hyphens/dashes in attribute values, e.g., week-one,
"attr-bans": ["align", "background", "bgcolor", "border", "frameborder", "longdesc", "marginwidth", "marginheight", "scrolling", "style", "width", "height", "onload", "onclick"], // ban deprecated/obsolete attributes
"tag-name-lowercase": true, // only lowercase for tag names
"tag-name-match": true, // tag names must match, in both name and case
"tag-close": true, // tags that open must close
"tag-self-close": true, // tags like <meta> must self-close: <meta />
"tag-bans": ["style", "iframe", "br", "hr"] // no on-pages styles (for now), no iframes, breaks, horizontal rules
"rules": {
"at-rule-name-case": "lower",
"at-rule-name-space-after": "always",
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-newline-before": "always-multi-line",
"block-closing-brace-space-before": "always-single-line",
"block-no-empty": true,
"block-opening-brace-newline-after": "always-multi-line",
"block-opening-brace-space-after": "always-single-line",
"block-opening-brace-space-before": "always",
"declaration-block-no-duplicate-properties": true,
"declaration-block-semicolon-newline-after": "always-multi-line",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",
"declaration-colon-space-after": "always",
"declaration-colon-space-before": "never",
"declaration-no-important": true,
"font-family-name-quotes": "always-where-recommended",
"indentation": 2,
"length-zero-no-unit": true,
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-name-case": "lower",
"media-feature-no-missing-punctuation": true,
"no-browser-hacks": true,
"no-descending-specificity": true,
"no-eol-whitespace": true,
"no-invalid-double-slash-comments": true,
"no-missing-end-of-source-newline": true,
"number-leading-zero": "always",
"number-no-trailing-zeros": true,
"property-case": "lower",
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-quotes": "always",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-list-comma-newline-after": "always-multi-line",
"selector-list-comma-space-after": "always-single-line",
"selector-pseudo-class-case": "lower",
"selector-type-case": "lower",
"string-quotes": "double",
"stylelint-disable-reason": "always-before",
"unit-blacklist": ["px", "pt", "in", "cm", "mm"],
"unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": "lower",
"value-list-comma-space-after": "always"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment