Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 186 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"rules": {
"at-rule-empty-line-before": ["always", {
"except": [
"blockless-after-same-name-blockless",
"first-nested"
],
"ignore": [
"after-comment"
],
"ignoreAtRules": [
"else",
"extend",
"if",
"include"
]
} ],
"at-rule-name-case": "lower",
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-empty-line-before": "never",
"block-closing-brace-newline-after": ["always", {
"ignoreAtRules": [
"if",
"else"
]
}],
"block-closing-brace-newline-before": "always-multi-line",
"block-closing-brace-space-before": "always-single-line",
"block-opening-brace-newline-after": "always-multi-line",
"block-opening-brace-space-after": "always-single-line",
"block-opening-brace-space-before": "always",
"color-hex-case": "lower",
"color-hex-length": "long",
"color-named": ["never", {
"ignore": [
"inside-function"
]
}],
"color-no-invalid-hex": true,
"comment-empty-line-before": ["always", {
"except": [
"first-nested"
],
"ignore": [
"stylelint-commands"
]
}],
"comment-no-empty": true,
"comment-whitespace-inside": "always",
"custom-property-empty-line-before": ["always", {
"except": [
"after-custom-property",
"first-nested"
],
"ignore": [
"after-comment",
"inside-single-line-block"
]
}],
"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-block-no-duplicate-properties": [true, {
"ignore": [
"consecutive-duplicates-with-different-values"
]
}],
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-semicolon-newline-after": "always-multi-line",
"declaration-block-semicolon-newline-before": "never-multi-line",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-semicolon-space-before": "never",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",
"declaration-colon-newline-after": "always-multi-line",
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"declaration-empty-line-before": ["always", {
"except": [
"after-declaration",
"first-nested"
],
"ignore": [
"after-comment",
"inside-single-line-block"
]
}],
"font-family-name-quotes": "always-unless-keyword",
"font-family-no-duplicate-names": true,
"font-family-no-missing-generic-family-keyword": true,
"font-weight-notation": "numeric",
"function-calc-no-invalid": true,
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "always-multi-line",
"function-comma-newline-before": "never-multi-line",
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-linear-gradient-no-nonstandard-direction": true,
"function-max-empty-lines": 0,
"function-name-case": "lower",
"function-parentheses-newline-inside": "always-multi-line",
"function-parentheses-space-inside": "never-single-line",
"function-url-quotes": "always",
"function-whitespace-after": "always",
"indentation": 2,
"keyframe-declaration-no-important": true,
"keyframes-name-pattern": "hx-.+",
"length-zero-no-unit": [true, {
"ignore": [
"custom-properties"
]
}],
"linebreaks": "unix",
"max-empty-lines": 2,
"max-line-length": 120,
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-name-case": "lower",
"media-feature-name-blacklist": [
"max-width"
],
"media-feature-name-no-unknown": true,
"media-feature-name-no-vendor-prefix": true,
"media-feature-parentheses-space-inside": "never",
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",
"media-query-list-comma-newline-after": "always-multi-line",
"media-query-list-comma-newline-before": "never-multi-line",
"media-query-list-comma-space-after": "always-single-line",
"media-query-list-comma-space-before": "never",
"no-duplicate-at-import-rules": true,
"no-empty-first-line": true,
"no-empty-source": true,
"no-eol-whitespace": true,
"no-extra-semicolons": true,
"no-missing-end-of-source-newline": true,
"number-leading-zero": "always",
"number-max-precision": 3,
"number-no-trailing-zeros": true,
"property-case": "lower",
"property-no-unknown": [true, {
"checkPrefixed": true
}],
"rule-empty-line-before": ["always-multi-line", {
"except": [
"first-nested"
],
"ignore": [
"after-comment"
]
}],
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-operator-space-before": "never",
"selector-attribute-quotes": "always",
"selector-list-comma-newline-after": "always-multi-line",
"selector-list-comma-newline-before": "never-multi-line",
"selector-list-comma-space-after": "always-single-line",
"selector-list-comma-space-before": "never-single-line",
"selector-max-empty-lines": 0,
"selector-type-case": "lower",
"selector-type-no-unknown": [true, {
"ignoreTypes": [
"/^hx-/"
]
}],
"shorthand-property-no-redundant-values": true,
"string-no-newline": true,
"string-quotes": "double",
"unit-blacklist": [
"cm",
"ex",
"in",
"mm",
"pc",
"pt"
],
"unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": "lower",
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-newline-before": "never-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
"value-list-max-empty-lines": 0
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"rollup-pluginutils": "^2.0.1",
"sinon": "^6.3.5",
"sinon-chai": "^3.2.0",
"stylelint": "^11.0.0",
"svg-inline-loader": "^0.8.0",
"tar": "^4.4.4",
"uglify-es": "^3.2.2",
Expand All @@ -75,7 +76,7 @@
"preghpages": "yarn generate",
"ghpages": "scripts/publish.js",
"install:clean": "rm -fr node_modules && yarn install",
"lint": "eslint -c .eslintrc.prod.json src",
"lint": "scripts/lint.sh",
"postversion": "git push upstream --tags",
"prepublishOnly": "yarn compile",
"rollup": "rollup -c rollup.config.js",
Expand Down
11 changes: 11 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

echo "[LINT] Checking JavaScript"
eslint -c .eslintrc.prod.json src

echo "[LINT] Checking Stylesheets"
stylelint "src/**/*.{scss,css}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only checking *.css and *.scss files, because the LESS source files will automatically get linted as we transition to SCSS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later on, we'll update this to include docs/**/*.{scss,css} too.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to lint always all files, or only files modified?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always lint all files. Linting changed files is an optimization that is negligible at this point, given that it doesn't take long to run linting and we're going to be updating the pipeline logic, anyway.


#echo "Linting Markup"
# TBD?

15 changes: 15 additions & 0 deletions scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ browserSync.emitter.on('init', () => {
exec('yarn webdriver:start', { cwd: CONFIG.testDir }); // don't log anything to the dev server
});

const lintStylesGlob = `${CONFIG.sourceDir}/**/*.{scss,css}`;

browserSync.init({
logLevel: 'debug',
notify: false,
Expand Down Expand Up @@ -98,6 +100,19 @@ browserSync.init({
fn: _.debounce(generateApis, 1500),
},

{
match: [
lintStylesGlob,
],
fn: _.debounce(() => {
let _cmd = `stylelint --color "${lintStylesGlob}"`;
let _proc = exec(_cmd, { cwd: CONFIG.root });

_proc.stdout.pipe(process.stdout);
_proc.stderr.pipe(process.stderr);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the prettiest way to do it, but we can refactor it later with new pipeline functionality.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eeek

}),
},

// Only copy when files change in dist/
{
match: [
Expand Down
Loading