From 0612dfe71666521dab84f3840df4b453eeeb4ec4 Mon Sep 17 00:00:00 2001 From: Jeremy Fields Date: Fri, 27 Sep 2019 12:27:07 -0600 Subject: [PATCH] Adding linting configs --- .editorconfig | 16 +++----- .eslintrc | 11 ++++++ .prettierrc | 3 +- .stylelintrc | 9 +++++ Gulpfile.js | 51 +++++++++++++----------- package.json | 2 + src/scripts/what-input.js | 3 +- src/styles/_layout.scss | 82 ++++++++++++++++++++------------------- yarn.lock | 17 ++++++++ 9 files changed, 119 insertions(+), 75 deletions(-) create mode 100644 .eslintrc create mode 100644 .stylelintrc diff --git a/.editorconfig b/.editorconfig index bea23a8..0ca4338 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,16 +1,12 @@ -# For more information about the properties used in -# this file, please see the EditorConfig documentation: -# http://editorconfig.org/ +# http://EditorConfig.org root = true +# Unix-style newlines with a newline ending every file [*] -charset = utf-8 -end_of_line = lf -indent_size = 2 indent_style = space -insert_final_newline = true +indent_size = 2 +end_of_line = lf +charset = utf-8 trim_trailing_whitespace = true - -[*.md] -trim_trailing_whitespace = false +insert_final_newline = true diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..563e9e4 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,11 @@ +{ + "extends": ["eslint:recommended"], + "parserOptions": { + "ecmaVersion": 2017 + }, + + "env": { + "es6": true, + "node": true + } +} diff --git a/.prettierrc b/.prettierrc index b18aca9..b2095be 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,4 @@ { "semi": false, - "singleQuote": true, - "tabWidth": 2 + "singleQuote": true } diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 0000000..5afccb2 --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,9 @@ +{ + "extends": ["stylelint-config-standard", "stylelint-config-prettier"], + "rules": { + "at-rule-no-unknown": [true, { + ignoreAtRules: ['include', 'extend', 'mixin', 'function', 'return', 'for', 'if', 'else', 'warn'] + }], + "no-descending-specificity": null + } +} diff --git a/Gulpfile.js b/Gulpfile.js index 3ccc5dc..d816caa 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -148,26 +148,31 @@ function deploy() { * default task */ -exports.default = gulp.series(clean, gulp.parallel(markup, scripts, styles, images)) -// gulp.task('default', () => { -// gulp.series('clean', gulp.parallel('markup', 'scripts', 'styles', 'images'), () => { -// $.browserSync.init({ -// server: { -// baseDir: './build/' -// } -// }) - -// gulp -// .watch( -// ['./src/scripts/what-input.js', './src/scripts/polyfills/*.js'], -// ['scripts'] -// ) -// .on('change', $.browserSync.reload) - -// gulp.watch(['./src/styles/{,*/}{,*/}*.scss'], ['styles']) - -// gulp -// .watch(['./src/markup/*.html'], ['markup']) -// .on('change', $.browserSync.reload) -// }) -// }) +function watch() { + $.browserSync.init({ + server: { + baseDir: './build/' + } + }) + + gulp.watch( + ['./src/scripts/what-input.js', './src/scripts/polyfills/*.js'], + scripts, + { events: 'all' }, + function() { + $.browserSync.reload + } + ) + + gulp.watch(['./src/styles/{,*/}{,*/}*.scss'], styles) + + gulp.watch(['./src/markup/*.html'], markup, { events: 'all' }, function() { + $.browserSync.reload + }) +} + +exports.default = gulp.series( + clean, + gulp.parallel(markup, scripts, styles, images), + watch +) diff --git a/package.json b/package.json index da1aa3e..a537b34 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,8 @@ "gulp-sourcemaps": "^2.6.5", "gulp-standard": "^14.0.0", "gulp-uglify": "^3.0.2", + "stylelint-config-prettier": "^6.0.0", + "stylelint-config-standard": "^19.0.0", "webpack-stream": "3.2.0" } } diff --git a/src/scripts/what-input.js b/src/scripts/what-input.js index d326e24..b65a412 100644 --- a/src/scripts/what-input.js +++ b/src/scripts/what-input.js @@ -182,7 +182,8 @@ module.exports = (() => { value = pointerType(event) } - const ignoreMatch = !specificMap.length && ignoreMap.indexOf(eventKey) === -1 + const ignoreMatch = + !specificMap.length && ignoreMap.indexOf(eventKey) === -1 const specificMatch = specificMap.length && specificMap.indexOf(eventKey) !== -1 diff --git a/src/styles/_layout.scss b/src/styles/_layout.scss index 16857c5..c148926 100644 --- a/src/styles/_layout.scss +++ b/src/styles/_layout.scss @@ -23,6 +23,7 @@ .well { @include clearfix; + background-color: #f5f5f5; border: 1px solid #e3e3e3; border-radius: 4px; @@ -52,46 +53,7 @@ padding-left: ($unit * 3); width: 50%; } -} -.list-group { - list-style: none; - padding: 0; -} - -.list-group-item { - &:first-child a { - border-radius: 4px 4px 0 0; - } - - &:last-child a { - border-bottom: 1px solid #ddd; - border-radius: 0 0 4px 4px; - } - - a { - @include a11y-focus; - background-color: #fff; - border: 1px solid #ddd; - border-bottom: none; - color: #555; - display: block; - padding: ($unit * 2) ($unit * 2); - text-decoration: none; - transition: all 0.2s ease; - - @include hover { - background-color: #f5f5f5; - } - - &:active, - &:focus { - position: relative; - } - } -} - -.well-column { button { appearance: none; background-color: #337ab7; @@ -132,6 +94,7 @@ input { &:not([type='submit']):not([type='checkbox']):not([type='radio']) { @include input-style-base; + box-shadow: inset 0 1px 1px rgba(#000, 0.075); transition: all 0.2s ease; @@ -153,6 +116,7 @@ select { @include input-style-base; + background-image: url(../images/select-arrow.svg); background-position: calc(100% - 10px) 50%; background-repeat: no-repeat; @@ -182,6 +146,7 @@ textarea { @include input-style-base; + box-shadow: inset 0 1px 1px rgba(#000, 0.075); height: 5em; padding-bottom: $unit; @@ -200,8 +165,47 @@ } } +.list-group { + list-style: none; + padding: 0; +} + +.list-group-item { + &:first-child a { + border-radius: 4px 4px 0 0; + } + + &:last-child a { + border-bottom: 1px solid #ddd; + border-radius: 0 0 4px 4px; + } + + a { + @include a11y-focus; + + background-color: #fff; + border: 1px solid #ddd; + border-bottom: none; + color: #555; + display: block; + padding: ($unit * 2) ($unit * 2); + text-decoration: none; + transition: all 0.2s ease; + + @include hover { + background-color: #f5f5f5; + } + + &:active, + &:focus { + position: relative; + } + } +} + footer { @include clearfix; + font-size: 14px; margin: ($unit * 4) 0; diff --git a/yarn.lock b/yarn.lock index fcf01a6..d1ed35c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7194,6 +7194,23 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= +stylelint-config-prettier@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/stylelint-config-prettier/-/stylelint-config-prettier-6.0.0.tgz#600aa218d8e34cf44a025903b0f60c079fd83366" + integrity sha512-f/BKiUAczB4KODC1w5eY6LoNgfq6QzdSnSc4ccAATKo1IfYCuG3IZwaxj/5AAxl1kyaW7kPLBOXG66O4gSIKTQ== + +stylelint-config-recommended@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-3.0.0.tgz#e0e547434016c5539fe2650afd58049a2fd1d657" + integrity sha512-F6yTRuc06xr1h5Qw/ykb2LuFynJ2IxkKfCMf+1xqPffkxh0S09Zc902XCffcsw/XMFq/OzQ1w54fLIDtmRNHnQ== + +stylelint-config-standard@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/stylelint-config-standard/-/stylelint-config-standard-19.0.0.tgz#66f0cf13f33b8a9e34965881493b38fc1313693a" + integrity sha512-VvcODsL1PryzpYteWZo2YaA5vU/pWfjqBpOvmeA8iB2MteZ/ZhI1O4hnrWMidsS4vmEJpKtjdhLdfGJmmZm6Cg== + dependencies: + stylelint-config-recommended "^3.0.0" + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"