mocha/no-mocha-arrows autofix

node v10.24.1
version: 0.0.0
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
const { Linter, CLIEngine } = require("eslint"); require("eslint-plugin-mocha"); require("@typescript-eslint/parser"); require("typescript"); const sample_code = ` /** Copyright notice */ describe("My describe", () => { before(() => { // some code }); beforeEach(() => { // some code }); it("My test", () => { // some code }); }); `; const eslint_config = { envs: ["es6", "mocha"], fix: true, useEslintrc: false, plugins: ["eslint-plugin-mocha"], parser: "@typescript-eslint/parser", rules: { "mocha/no-mocha-arrows": "error" } }; const cli = new CLIEngine(eslint_config); const messages = cli.executeOnText(sample_code); console.log(messages.results[0].output);
Demonstrator for the issue. When you run the code, four "function()" should be output at the top of the file, before the copyright notice. They should instead replace the arrow functions below.
Loading…

no comments

    sign in to comment