Welcome, this repo is part of my youtube video about Creating your own ESLint from scratch (en-us)
First of all, leave your star 🌟 on this repo.
Access our exclusive telegram channel so I'll let you know about all the content I've been producing
- Access it in app
Go to app and restore dependencies as follows:
nvm use
npm i
npm link
eslint-clone --file filename.js
eslint-clone --file error.js
Outputs
Error: use "const" instead of "var"
error.js:1:1
Error: use single quotes instead of double quotes
error.js:1:12
Error: use single quotes instead of double quotes
error.js:1:23
Error: use "const" instead of "var"
error.js:2:1
Error: use single quotes instead of double quotes
error.js:3:24
Error: use "let" instead of "var"
error.js:5:1
Error: use single quotes instead of double quotes
error.js:6:25
Error: use single quotes instead of double quotes
error.js:9:25
Error: use "const" instead of "let"
error.js:15:1
Error: use single quotes instead of double quotes
error.js:15:25
Error: use single quotes instead of double quotes
error.js:17:9
Linting completed with 11 error(s).
Code fixed and saved at ./error.linted.js successfully!
npm unlink eslint-clone
- fix the bug when replacing quotes
-
if a code have single quotes enclosing double quotes such as:
const name = '"ana"'
it'd be transformed as below and will cause a syntax error.
const name = ''ana''
-
How to fix: replace it to a template string instead.
- Input:
'"double"'.replaceAll('"', "'");
- Current Output:
''double''.replaceAll(''', ''');
- Expected Output:
`"double"`.replaceAll(`"`, `'`);
- Input:
-
- keep line breaks
- keep comments
- keep spaces
- don't put semicolons automatically
- report missing semicolon ';'