JavaScript Linter
ESLint for JavaScript, TypeScript and JSX: explained problems and safe fixes.
Linted as you type; Ctrl/⌘ + Enter lints now. The code is parsed, never run, and stays in your browser.
Problems
About the JavaScript Linter
Paste JavaScript, TypeScript or JSX and ESLint checks it in your browser as you type. Every problem comes with its line and column, the rule that found it, a sentence on why it matters and a link to the rule’s documentation; Show selects the spot in the editor. Problems with an automatic fix get a Fix button and Fix all applies every one of them; suggestions, which could change what the code does, are applied one at a time and only when you choose.
Three rule sets: Recommended — ESLint’s own recommended rules: undefined variables, unreachable code, duplicate keys, assignments in conditions; Strict — adds rules against error-prone patterns such as ==, var, eval and throwing strings; Legacy browsers — reports the syntax and built-ins that ES5-only browsers such as Internet Explorer 11 do not have. TypeScript is read with the TypeScript compiler’s parser and checked with typescript-eslint’s rules that need no type information. The code is parsed, never run, and never leaves your device.
How to use it
- Paste your code, open a file or drop one on the editor. The language (JavaScript, JSX, TypeScript) and the globals (browser or Node.js) are detected; choose them yourself if the guess is wrong.
- Pick a rule set: Recommended, Strict or Legacy browsers. The problems update as you type.
- Read each problem: its line and column, the rule, why it matters and a link to the rule’s page. Show selects the code; Turn off rule hides a rule you do not want.
- Press Fix on a problem, Fix all for every automatic fix, or a suggestion’s button. Undo restores the code from before the last fix.
- Copy or download the fixed code, or the report as text or as ESLint’s JSON format.
Examples
function greet(name) {
if (name = '') return 'Hello!';
return 'Hello, ' + nme;
}
greet('Ana');
2:7 Expected a conditional expression and instead saw an assignment. no-cond-assign 2:7 Unexpected constant condition. no-constant-condition 2:7 'name' is assigned a value but never used. no-unused-vars 3:22 'nme' is not defined. no-undef
export function firstName(users: any[]): string {
return users[0]!.name;
}
1:34 Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any 2:10 Forbidden non-null assertion. @typescript-eslint/no-non-null-assertion
var prices = [3, 4.5];
var total = prices.reduce((sum, p) => sum + p, 0);
document.title = `Total: ${total}`;
2:27 Arrow functions (ES2015) are not supported by ES5-only browsers such as Internet Explorer 11: write function () { … } (mind `this`), or transpile the code (Babel, SWC, esbuild with an ES5 target). legacy/es5-syntax
3:18 Template literals (ES2015) are not supported by ES5-only browsers such as Internet Explorer 11: join strings with +. legacy/es5-syntaxLimitations
- One file at a time: imports are not followed, so missing modules and unused exports are not found.
- Rules that need TypeScript type information, and plugins such as React Hooks, import or Vue, are not included.
- Not checked: formatting, and anything that only shows up when the code runs.
- Code up to 5 million characters; linting stops after 30 seconds.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot. ESLint (about 330 KB compressed) is downloaded from this site when you first open the linter, and the TypeScript parser (about 1 MB more) the first time you lint TypeScript; after that it works offline. Your code is never uploaded.
Frequently asked questions
Is my code uploaded or run?
Neither. ESLint parses the code into a syntax tree and checks the tree; nothing is executed. It all happens in your browser, in a background worker, so a large file never freezes the page.
Which rules are in each set?
Recommended is ESLint’s eslint:recommended set: the rules its documentation marks as recommended. Strict adds more than fifty rules that catch real mistakes or risky code — eqeqeq, no-var, prefer-const, no-eval, no-throw-literal, array-callback-return, no-implicit-coercion, no-await-in-loop and more — and no formatting rules. Legacy browsers adds two rules written for this tool: one for syntax newer than ECMAScript 5 (arrow functions, classes, let/const, template literals, destructuring…) and one for built-ins such as Promise, fetch, Array.from or .includes() that need a polyfill.
How is TypeScript checked?
With the TypeScript compiler’s parser and typescript-eslint’s scope analysis, and the rules of typescript-eslint’s recommended configuration that need no type information (no-explicit-any, ban-ts-comment, no-empty-object-type …); Strict adds no-non-null-assertion, no-dynamic-delete and no-non-null-asserted-nullish-coalescing from its strict set and asks for longer @ts-expect-error descriptions. The typescript-eslint plugin itself cannot run in a web page, so its rules are ported, and the tests check that they report exactly what the plugin reports. As typescript-eslint recommends, the core rules the TypeScript compiler already covers (no-undef, no-redeclare …) are off for TypeScript. Rules that need type information, such as no-floating-promises, need the whole project and the compiler’s type checker, so they are not available.
Why is a variable reported as not defined?
no-undef knows only the globals of the environment: choose Browser, Node.js or both under Globals, or declare a name at the top of the code with a comment such as /* global jQuery, myConfig */. Variables that come from other files must be imported.
Are the fixes safe?
ESLint’s automatic fixes are designed not to change what the code does — for example let to const when the variable is never reassigned. Changes that might (removing an unused variable, == to ===) are only offered as suggestions, which you apply one by one. Check the result either way, and Undo restores the code from before the last fix.
Do the eslint-disable comments in my code work?
Yes: // eslint-disable-next-line, /* eslint-disable */ and inline rule settings work as in ESLint, and @typescript-eslint/no-unused-vars and other typescript-eslint names apply to the rules that run here. Comments about rules from plugins this linter does not include (React Hooks, import, Vue…) simply have no effect. /* eslint-env */ comments are no longer supported by ESLint: choose the globals instead.
Does it check formatting or use my own config file?
No to both. It has no formatting rules (ESLint has retired its own; a formatter such as Prettier does that job — see the JavaScript formatter), and it uses the three rule sets above, not an eslint.config.js. You can turn individual rules off from the problem list.