Skip to content

Commit 6c1a18c

Browse files
committed
MLE-24763 Upgrading from jshint to eslint
No linting fixes yet. Changing from the older jshint to the modern eslint. The eslint config doesn't enforce whitespace yet, will do that in a later PR.
1 parent 448f4ac commit 6c1a18c

File tree

5 files changed

+489
-1195
lines changed

5 files changed

+489
-1195
lines changed

.jshintrc

Lines changed: 0 additions & 11 deletions
This file was deleted.

eslint.config.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// ESLint 9+ flat config
2+
const globals = require("globals");
3+
4+
module.exports = [
5+
{
6+
// Base configuration for all JS files
7+
files: ["**/*.js"],
8+
languageOptions: {
9+
ecmaVersion: 2022,
10+
sourceType: "commonjs", // Node.js uses CommonJS
11+
globals: {
12+
...globals.commonjs,
13+
...globals.node,
14+
...globals.browser, // Add browser globals like setTimeout
15+
structuredClone: "readonly",
16+
// Legacy globals from old config
17+
Atomics: "readonly",
18+
SharedArrayBuffer: "readonly"
19+
}
20+
},
21+
rules: {
22+
// Spacing and formatting
23+
"indent": "off", // TODO: Fix indentation in separate PR
24+
"linebreak-style": ["error", "unix"],
25+
"quotes": ["error", "single"],
26+
"semi": ["error", "always"],
27+
28+
// Modern best practices
29+
"eqeqeq": "error",
30+
"curly": ["error", "all"], // Require braces for all control structures
31+
"no-unused-vars": "error",
32+
"no-undef": "error",
33+
34+
// Spacing rules (disabled for initial setup - TODO: Fix in separate PR)
35+
"arrow-spacing": "off",
36+
"space-before-blocks": "off",
37+
"space-before-function-paren": "off",
38+
"space-in-parens": "off",
39+
"object-curly-spacing": "off",
40+
"keyword-spacing": "off",
41+
"comma-spacing": "off",
42+
"key-spacing": "off",
43+
"space-infix-ops": "off",
44+
45+
// Style rules (disabled for initial setup - TODO: Fix in separate PR)
46+
"array-bracket-spacing": "off",
47+
"block-spacing": "off",
48+
"brace-style": "off",
49+
"func-call-spacing": "off",
50+
"no-trailing-spaces": "off",
51+
52+
// Disable console errors for this project
53+
"no-console": "off",
54+
55+
// Bracket notation preference
56+
"dot-notation": "error"
57+
}
58+
},
59+
{
60+
// Ignore patterns
61+
ignores: [
62+
"**/data/*.js",
63+
"node_modules/**",
64+
"coverage/**"
65+
]
66+
}
67+
];

gulpfile.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
const path = require('path');
55
const gulp = require('gulp');
6-
const jshint = require('gulp-jshint');
6+
const eslint = require('gulp-eslint-new');
77
const mocha = require('gulp-mocha');
88
const jsdoc = require('gulp-jsdoc3');
99

@@ -17,9 +17,10 @@ const basicloader = require('./lib/basic-loader.js');
1717
const streamToArray = require("stream-to-array");
1818

1919
function lint() {
20-
return gulp.src('lib/*')
21-
.pipe(jshint({lookup:true}))
22-
.pipe(jshint.reporter('default'));
20+
return gulp.src('lib/*.js')
21+
.pipe(eslint({ overrideConfigFile: 'eslint.config.js' }))
22+
.pipe(eslint.format())
23+
.pipe(eslint.failAfterError());
2324
}
2425

2526
function test() {

0 commit comments

Comments
 (0)