Skip to content

[TOOLING] Addition of ESLint and prettier configuration #116

@pranjalwalia

Description

@pranjalwalia

Describe the solution you'd like

Addition of ESLint (as static code analyser) and prettier (to enforce code styles via a configuration file) .

Additional information

Currently, the code base does not employ any methods for standardising code quality and consistency across multiple contributors. This can be achieved via the addition of ESLint and prettier respectively. This will completely remove changes that do not pertain to changes in logic across PRs. This issue was apparent because my existing prettier config in vscode was in conflict with the existing code practices in NodeCloud and even a minor change went ahead and formatted the entire file, this will reduce the readability for project maintainers in pull requests.

Impact

Adds a default coding style and removes unnecessary changes in code in multiple PRs across multiple contributors. For example, switching between single and double quotes across multiple PRs in the same code segment. Additionally, the formatter used currently is pretty-quick with no configuration file present, because of this #109 is required, although this is not feasible as the number of contributors in the project increases and should be automated before a commit. Additionally, best practices should be enforced via the use ESLint which can be updated as required via a config file.

Attaching instances of apparent inconsistencies

References

  • misconfiguration of the formatter
    In each commit, the pretty-quick script is run by husky, and this takes the default config of prettier set in the user's vscode, due to this an entire file gets formatted even when there is no major change in it, makes the process of reviewing changes difficult.

  • conflicting single/double quote and trailing comma rules
    Screenshot from 2022-04-13 23-32-41

  • Additional conflicting linting rules with respect to imports, implicit any types and empty function definitions, all these are sources of potential bugs in future and can be avoided by using eslint and enforcing consistent practices.
    Screenshot from 2022-04-13 23-48-28

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions