forked from COS-301/miniproject-2023
Linting using Eslint
Bandisa edited this page Apr 11, 2023
·
2 revisions
- Go to the folder/file you have modified
- Copy the relative Path
- Go to the root of the project and run
yarn lint relative/path/to/modified/fileOrFolder
- The syntax will be fixed were possible, detailed errors will be produced, which should be fixed
- Fix remaining errors, if any
- Test by running the command again
yarn lint relative/path/to/modified/file
- Eslint supports linting an entire folder, meaing you can lint an entire foler, if you paste it's relative path
- Use Git status to check all the files you have modified and ensure that they have been linted
- Maximum length per line of code is set at 120 chars, excluding urls
"max-len":["error",{"code":120,"ignoreUrls":true}]
- No spacing before a semi colon, spacing after it
"semi-spacing": ["error", {"before": false, "after": true}]
- Commas that do not seperate elements are't allowed
"comma-dangle":"error"
- 2 array elements in one line during initialization, after, they should be seperated by a new-line
"array-element-newline": ["error", { "ArrayExpression": "consistent", "ArrayPattern": { "minItems": 2 } }]
- There are many more rules applied than the ones listed above since we are extending from other standard rules