Skip to content

Commit

Permalink
Adds gulp task eslint
Browse files Browse the repository at this point in the history
Reformats code using `airbnb` eslint preset
Removes `test/index.test.js`
Removes `src/index.js`
  • Loading branch information
jalik committed Mar 30, 2018
1 parent 506e6fd commit c2d9ac6
Show file tree
Hide file tree
Showing 12 changed files with 2,364 additions and 814 deletions.
11 changes: 11 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"env": {
"browser": true,
"node": true,
"jest/globals": true
},
"extends": "airbnb",
"plugins": [
"jest"
]
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

# Ignore npm files
node_modules
npm-debug.log

# Ignore compiled sources
aio
Expand Down
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Ignore build settings
.babelrc
gulpfile.js
npm-debug.log
webpack.config.js

# Ignore sources
Expand Down
55 changes: 33 additions & 22 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,47 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

const gulp = require("gulp");
const babel = require("gulp-babel");
const stripComments = require("gulp-strip-comments");
const watch = require("gulp-watch");
const distPath = "dist";

// Compile JavaScript files
gulp.task("build", () => {
return gulp.src([
"src/**/*.js"
])
.pipe(babel({presets: ["env"]}))
.pipe(stripComments())
.pipe(gulp.dest(distPath));
});
const babel = require('gulp-babel');
const del = require('del');
const eslint = require('gulp-eslint');
const gulp = require('gulp');
const watch = require('gulp-watch');

// Compile source files
gulp.task("default", ["build"]);
const buildPath = 'dist';

// Compile JS files
gulp.task('build', () => gulp.src([
'src/**/*.js',
])
.pipe(babel())
.pipe(gulp.dest(buildPath)));

// Remove compiled files
gulp.task('clean', () => del([buildPath]));

// Check code quality
gulp.task('eslint', () => gulp.src([
'src/**/*.js',
'test/**/*.js',
'!node_modules/**',
])
.pipe(eslint())
.pipe(eslint.formatEach())
.pipe(eslint.failAfterError()));

// Prepare files for publication
gulp.task("prepublish", ["build"]);
gulp.task('prepublish', gulp.series('clean', 'eslint', 'build'));

// Rebuild automatically
gulp.task("watch", () => {
gulp.watch(["src/**/*.js"], ["build"]);
});
gulp.task('watch', () => watch(['src/**/*.js'], ['build']));

// Compile source files
gulp.task('default', gulp.series('prepublish'));
Loading

0 comments on commit c2d9ac6

Please sign in to comment.