Clean JS code
JS files (pages, components, classes ...) in the src
folder are polluted by wrong practices. They need to be cleaned up.
To ensure a global formating on project files, we need to add a formatter tool. Prettier is great for this, and can be set as pre-commit hooks. It forces formatting with the same standard whenever a commit is added to the project. This allows to correct mistakes, thus creating a cleaner repository. Don't forget to verify conflicts with eslint and document this in the Contribution guide or README.md file.
To-do's:
- Add Prettier, Eslint, Husky packages as devDependencies
- Add scripts in package.json to lint and format code in src folder
- Add a configuration object in package.json for Eslint (with Airbnb base)
- Add a configuration object in package.json for Husky
- Add a configuration object in package.json for Prettier
- Document what this does in README.md
-
Format src folder
- Remove blank lines
- Remove useless imports
- Remove useless variables
-
Clean src folder
-
Remove useless
console.log
-
Convert wrong variables (
var
toconst
orlet
) -
Correct wrong imports (
require
instead ofimport from
) -
Create global functions in
Utils.js
for re-used things (ex: url building from env variables likeloginUrl
)
-
Remove useless