Skip to content

Commit

Permalink
chore: do not slow down the dev process by linting all the files on e…
Browse files Browse the repository at this point in the history
…very save
  • Loading branch information
limonte committed Jul 22, 2019
1 parent 1563d65 commit ba9810c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 71 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -193,11 +193,10 @@ If you would like to contribute enhancements or fixes, please do the following:
3. When in the SweetAlert2 directory, run `npm install` or `yarn install` to install dependencies.

4. To begin active development, run `npm start` or `yarn start`. This does several things for you:
- Lints your code
- Builds the `dist` folder
- Serves sandbox.html @ http://localhost:8080/ (browser-sync ui: http://localhost:8081/)
- Serves unit tests @ http://localhost:3000
- Re-lints, re-builds, re-loads and re-tests as necessary when files change
- Re-builds, re-loads and re-tests as necessary when files change

Backers
-------
Expand Down
29 changes: 1 addition & 28 deletions gulpfile.js
@@ -1,5 +1,4 @@
const gulp = require('gulp')
const noop = require('gulp-noop')
const rollup = require('gulp-rollup')
const gulpif = require('gulp-if')
const uglify = require('gulp-uglify')
Expand All @@ -8,8 +7,6 @@ const css2js = require('gulp-css2js')
const concat = require('gulp-concat')
const autoprefixer = require('gulp-autoprefixer')
const cleanCss = require('gulp-clean-css')
const eslint = require('gulp-eslint')
const stylelint = require('gulp-stylelint')
const babel = require('rollup-plugin-babel')
const json = require('rollup-plugin-json')
const merge = require('merge2')
Expand All @@ -26,7 +23,6 @@ const banner = `/*!
* Released under the ${packageJson.license} License.
*/`

const allScriptFiles = ['**/*.js', 'sweetalert2.d.ts', '!dist/**', '!node_modules/**']
const srcScriptFiles = ['src/**/*.js']
const srcStyleFiles = ['src/**/*.scss']

Expand Down Expand Up @@ -135,35 +131,12 @@ gulp.task('default', gulp.parallel('build'))

// ---

gulp.task('lint:scripts', () => {
return gulp.src(allScriptFiles)
.pipe(eslint())
.pipe(eslint.format())
.pipe(continueOnError ? noop() : eslint.failAfterError())
})

gulp.task('lint:styles', () => {
return gulp.src(srcStyleFiles)
.pipe(stylelint({
failAfterError: !continueOnError,
reporters: [
{ formatter: 'string', console: true }
]
}))
})

gulp.task('lint', gulp.parallel('lint:scripts', 'lint:styles'))

// ---

gulp.task('develop', gulp.series(
gulp.parallel('lint', 'build'),
'build',
async function watch () {
// Does not rebuild standalone files, for speed in active development
gulp.watch(srcScriptFiles, gulp.parallel('build:scripts'))
gulp.watch(srcStyleFiles, gulp.parallel('build:styles'))
gulp.watch(allScriptFiles, gulp.parallel('lint:scripts'))
gulp.watch(srcStyleFiles, gulp.parallel('lint:styles'))
},
async function sandbox () {
browserSync.init({
Expand Down
8 changes: 2 additions & 6 deletions package.json
Expand Up @@ -32,12 +32,9 @@
"gulp-clean-css": "^4.0.0",
"gulp-concat": "^2.6.1",
"gulp-css2js": "^1.1.2",
"gulp-eslint": "^6.0.0",
"gulp-if": "^3.0.0",
"gulp-noop": "^1.0.0",
"gulp-rename": "^1.2.2",
"gulp-rollup": "^2.16.2",
"gulp-stylelint": "^9.0.0",
"gulp-uglify": "^3.0.0",
"jquery": "^3.3.1",
"karma": "^4.0.0",
Expand Down Expand Up @@ -95,12 +92,11 @@
},
"scripts": {
"start": "gulp develop --continue-on-error --skip-minification --skip-standalone",
"fix:lint": "eslint --fix .",
"test": "npm run build && npm run check",
"lint": "stylelint src; eslint src test tools bin *.js *.ts",
"build": "gulp build",
"check": "npm run check:lint && npm run check:require-in-node && npm run check:qunit && npm run check:qunit:minified && npm run check:ts",
"check": "npm run lint && npm run check:require-in-node && npm run check:qunit && npm run check:qunit:minified && npm run check:ts",
"check:sauce": "npm run check:qunit:sauce && npm run check:qunit:minified:sauce",
"check:lint": "gulp lint",
"check:require-in-node": "node test/require-in-node",
"check:jest": "jest --ci",
"check:qunit": "karma start karma.conf.js --single-run",
Expand Down
2 changes: 1 addition & 1 deletion src/instanceMethods/_main.js
Expand Up @@ -52,7 +52,7 @@ export function _main (userParams) {
}

const swalPromise = (instance, domCache, innerParams) => {
return new Promise((resolve) => { // eslint-disable-line complexity
return new Promise((resolve) => {
// functions to handle all closings/dismissals
const dismissWith = (dismiss) => {
instance.closePopup({ dismiss })
Expand Down
33 changes: 2 additions & 31 deletions yarn.lock
Expand Up @@ -3155,7 +3155,7 @@ extglob@^2.0.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"

fancy-log@^1.3.2, fancy-log@^1.3.3:
fancy-log@^1.3.2:
version "1.3.3"
resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7"
integrity sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw==
Expand Down Expand Up @@ -3725,15 +3725,6 @@ gulp-css2js@^1.1.2:
replace-ext "^1.0.0"
through2 "*"

gulp-eslint@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/gulp-eslint/-/gulp-eslint-6.0.0.tgz#7d402bb45f8a67652b868277011812057370a832"
integrity sha512-dCVPSh1sA+UVhn7JSQt7KEb4An2sQNbOdB3PA8UCfxsoPlAKjJHxYHGXdXC7eb+V1FAnilSFFqslPrq037l1ig==
dependencies:
eslint "^6.0.0"
fancy-log "^1.3.2"
plugin-error "^1.0.1"

gulp-if@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/gulp-if/-/gulp-if-3.0.0.tgz#6c3e7edc8bafadc34f2ebecb314bf43324ba1e40"
Expand All @@ -3750,13 +3741,6 @@ gulp-match@^1.1.0:
dependencies:
minimatch "^3.0.3"

gulp-noop@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/gulp-noop/-/gulp-noop-1.0.0.tgz#082b1142493512ce5c5ab2e1ec3e7bb48b575c79"
integrity sha1-CCsRQkk1Es5cWrLh7D57tItXXHk=
dependencies:
through2 "^2.0.1"

gulp-rename@^1.2.2:
version "1.4.0"
resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-1.4.0.tgz#de1c718e7c4095ae861f7296ef4f3248648240bd"
Expand All @@ -3774,19 +3758,6 @@ gulp-rollup@^2.16.2:
rollup-plugin-hypothetical "^2.0.0"
vinyl "^2.1.0"

gulp-stylelint@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/gulp-stylelint/-/gulp-stylelint-9.0.0.tgz#c87e9dd990f24d1283d9cc08b7f17329d3712efa"
integrity sha512-JoYzy68jc26Z53ZtCJq9teZ81u3QS5DUwoRKHkPbs6k0xpafOVYnRIoOCDGc59vRWTvMDahxyaTlNvolCzr+sA==
dependencies:
chalk "^2.4.2"
fancy-log "^1.3.3"
mkdirp "^0.5.1"
plugin-error "^1.0.1"
source-map "^0.7.3"
strip-ansi "^5.2.0"
through2 "^3.0.1"

gulp-uglify@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.2.tgz#5f5b2e8337f879ca9dec971feb1b82a5a87850b0"
Expand Down Expand Up @@ -7755,7 +7726,7 @@ through2@*, through2@3.0.1, through2@^3.0.1:
dependencies:
readable-stream "2 || 3"

through2@^2.0.0, through2@^2.0.1, through2@^2.0.3, through2@~2.0.0:
through2@^2.0.0, through2@^2.0.3, through2@~2.0.0:
version "2.0.5"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==
Expand Down

0 comments on commit ba9810c

Please sign in to comment.