How to run Gulp ESLint in HTML JS script tag

I configured Gulp on ESLint javascript in HTML script tags with the following code.

const eslint = require('gulp-eslint');

gulp.task('process-js', () => {
  const scripts = processInline();

  return gulp.src(['src/*.html'])
    .pipe(errorNotifier())
  
    .pipe(scripts.extract('script'))
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError())
    .pipe(scripts.restore())

    .pipe(gulp.dest('dist'))
});
Run codeHide result

Linter works well, but it seems to give me line numbers that do not match my HTML files, and line numbers of extracted javascript from script tags that I never see.

How to get line numbers in an HTML file? Or can I better use javascript in an HTML script?

+4
source share
1 answer

You can use Atom, it has eslint plugin. http://oceanpad.imtqy.com/2016/08/22/2016-08/To-Introduce-ESLint-to-Atom/

It is very good.

-2
source

Source: https://habr.com/ru/post/1656775/


All Articles