Skip to content

Enforce ES5 only #1539

Closed
Closed
@rreusser

Description

@rreusser

It would be nice to include this as a test step. A quick script:

var CLIEngine = require("eslint").CLIEngine;

var cli = new CLIEngine({
    envs: ["browser", "mocha"], // ??? just copied it. not sure what this does.
    useEslintrc: false,
    ignore: false,
    parserOptions: {
        ecmaVersion: 5
    }   
});

var report = cli.executeOnFiles(["dist/plotly.js"]);
var formatter = cli.getFormatter();

console.log(formatter(report.results));

if (report.errorCount > 0) {
    process.exit(1);
}

Running this on 1.25.1 gives:

$ node es5only.js

/Users/rreusser/plotly/plotly.js/dist/plotly.js
  7:1  error  Parsing error: The keyword 'const' is reserved

✖ 1 problem (1 error, 0 warnings)

Remaining tasks:

  1. find the right place for it (tasks?)
  2. fix the ignore details. Right now it uses eslintignore which excludes everything we want to include. We either need to grab the directory listing and filter out /\.min\.js$ manually or figure out the right incantation. Should be simple.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions