Let's follow these steps to add an ESLint linter test suite to our Express web server:
- First, we will create a new test file, called /test/test-eslint.ts, in our test directory. We won't need to include mocha-typescript since mocha-eslint configures our suites and tests for us. Instead, we'll simply configure which directories we want to lint and what the output format should be:
import * as lint from 'mocha-eslint';let paths = [ 'src', 'test'];let options = { formatter: 'stylish', strict: true, contextName: 'ESLint'};lint(paths, options);
- Next, we'll need to create an ESLint configuration file, called .eslintrc.js, in the root of our project. This file is a configuration file for how ESLint should run in our project. As ...