Skip to content

Enforce ES5 only #1539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rreusser opened this issue Mar 30, 2017 · 2 comments
Closed

Enforce ES5 only #1539

rreusser opened this issue Mar 30, 2017 · 2 comments

Comments

@rreusser
Copy link
Contributor

rreusser commented Mar 30, 2017

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.
@etpinard
Copy link
Contributor

@rreusser
Copy link
Contributor Author

Closing since it's all on the PR now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants