I am currently in the process of updating a Gulp task that uses gulp-tslint
to now use gulp-eslint
. The code snippet below outlines the changes I need to make:
const { src } = require('gulp');
const config = require('./config');
const plugins = require('gulp-load-plugins')();
const plumber = require('./plumber-wrapper');
const mergeStream = require('merge-stream');
const gulpTsLint = require('gulp-tslint');
const tslint = require('tslint');
function lintTask () {
const { srcDir, jsDir, sassFiles } = config
const tsLintProgram = tslint.Linter.createProgram('./tsconfig.json')
const typeScript = src(`${srcDir}${jsDir}**/*.ts`)
.pipe(plumber())
// lint according to rules defined in `tslint.json`
.pipe(
gulpTsLint({
formatter: 'verbose',
/**
* type-checked rules require a TypeScript `program` object.
* ensure 'Linter.createProgram' is called inside the gulp task else the
* contents of the files will be cached if this tasks is called again,
* e.g. as part of a `watch` task
*/
program: tsLintProgram
})
)
.pipe(gulpTsLint.report());
const sass = src(`${srcDir}${sassFiles().all}`)
.pipe(plumber())
// lint according to rules defined in `.stylelintrc`
.pipe(
plugins.stylelint({
failAfterError: true,
reporters: [
{
formatter: 'string',
console: true
}
],
debug: true
})
);
return mergeStream([typeScript, sass]);
};
module.exports = lintTask;
All my NPM Tasks have been successfully migrated from TSLint to ESLint except for this one. I'm struggling to find a straightforward solution and would greatly appreciate assistance with converting it to ESLint while keeping it exported as lintTask at the end.
I've done some research on Google but most tutorials are focused on JavaScript rather than TypeScript. Can anyone provide guidance?
Your help would be much appreciated!