Browse Source

ESLint: Set environments better

Instead of setting ESLint environment to "node" globally, set it on
per-directory basis using separate .eslintrc.json files:

  Directory   Environment
  -----------------------
  bin         node
  lib         commonjs
  spec        jasmine

It was impossible to use this approach for the "benchmark" directory
which contains a mix of files used in various environments. For
benchmark/run, the environment is set inline. For the other files, as
well as spec/helpers.js, the globals are declared manually (it is
impossible to express how these files are used just by a list of
environments).

Fixes #408.
redux
David Majda 6 years ago
parent
commit
e61c23c634
  1. 5
      .eslintrc.json
  2. 2
      benchmark/benchmarks.js
  3. 1
      benchmark/run
  4. 2
      benchmark/runner.js
  5. 5
      bin/.eslintrc.json
  6. 5
      lib/.eslintrc.json
  7. 5
      spec/.eslintrc.json
  8. 3
      spec/api/generated-parser-api.spec.js
  9. 1
      spec/api/pegjs-api.spec.js
  10. 1
      spec/api/plugin-api.spec.js
  11. 1
      spec/behavior/generated-parser-behavior.spec.js
  12. 2
      spec/helpers.js
  13. 1
      spec/unit/compiler/passes/generate-bytecode.spec.js
  14. 1
      spec/unit/compiler/passes/helpers.js
  15. 1
      spec/unit/compiler/passes/remove-proxy-rules.spec.js
  16. 1
      spec/unit/compiler/passes/report-infinite-loops.spec.js
  17. 1
      spec/unit/compiler/passes/report-left-recursion.spec.js
  18. 1
      spec/unit/compiler/passes/report-missing-rules.spec.js
  19. 1
      spec/unit/parser.spec.js

5
.eslintrc.json

@ -1,6 +1,3 @@
{
"extends": "eslint:recommended",
"env": {
"node": true
}
"extends": "eslint:recommended"
}

2
benchmark/benchmarks.js

@ -1,3 +1,5 @@
/* global module */
"use strict";
(function(root, factory) {

1
benchmark/run

@ -1,5 +1,6 @@
#!/usr/bin/env node
/* eslint-env node */
/* eslint no-console: 0*/
"use strict";

2
benchmark/runner.js

@ -1,3 +1,5 @@
/* global module, setTimeout */
"use strict";
(function(root, factory) {

5
bin/.eslintrc.json

@ -0,0 +1,5 @@
{
"env": {
"node": true
}
}

5
lib/.eslintrc.json

@ -0,0 +1,5 @@
{
"env": {
"commonjs": true
}
}

5
spec/.eslintrc.json

@ -0,0 +1,5 @@
{
"env": {
"jasmine": true
}
}

3
spec/api/generated-parser-api.spec.js

@ -1,6 +1,5 @@
/* eslint-env jasmine */
/* eslint no-console: 0 */
/* global PEG */
/* global PEG, console */
"use strict";

1
spec/api/pegjs-api.spec.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

1
spec/api/plugin-api.spec.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

1
spec/behavior/generated-parser-behavior.spec.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

2
spec/helpers.js

@ -1,3 +1,5 @@
/* global require */
"use strict";
(function(root) {

1
spec/unit/compiler/passes/generate-bytecode.spec.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

1
spec/unit/compiler/passes/helpers.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

1
spec/unit/compiler/passes/remove-proxy-rules.spec.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

1
spec/unit/compiler/passes/report-infinite-loops.spec.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

1
spec/unit/compiler/passes/report-left-recursion.spec.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

1
spec/unit/compiler/passes/report-missing-rules.spec.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

1
spec/unit/parser.spec.js

@ -1,4 +1,3 @@
/* eslint-env jasmine */
/* global PEG */
"use strict";

Loading…
Cancel
Save