x-stend / x

`x$` is a highly flexible and extendable utility library for JavaScript and TypeScript, designed to streamline the integration and extension of various utility libraries like lodash, moment, and ramda. With `x$`, developers can easily create custom higher-order functions, ensuring adaptability and maintainability in their codebase.
MIT License
0 stars 0 forks source link

[ARCHITECTURE]: Update linting rules #34

Open cstroliadavis opened 5 months ago

cstroliadavis commented 5 months ago

Summary

Need to make the eslint/tslint rules for this project a bit more strict than the defaults

Details

The eslint/tslint recommended, and even the "default" values for the "all" rules settings seem to be way too permissive. They allow a wide range of ways of doing things that can make it very difficult to maintain a common structure.

Suggested Changes

Ideally, we want to have a style and ruleset that is at least similar to the AirBnb style of lint rules. AirBnb has not yet been ported to the new style of eslint configuration and has lots of outdated rules that have been deprecated or removed, so simply "extending" our current model with the AirBnb ruleset is likely not to be the answer. This may involve creating our own set of rules, based on AirBnb and integrating it into the new format, and using "@stylistic" rules, in place of any of the deprecated stylistic eslint and tslint rule sets. Many of these rules are one-for-one, but there are a number of new rules and variants that "cover" what AirBnb was doing, but in a different way that will likely require some porting.

Impact

Having a strict linting and style system will help enforce a consistent style of development which leads to less confusion over time and improves the overall environment. It also reduces the amount of time needed by reviewers to check common mistakes and can reduce the effort of the developer for rules that can be "--fix"ed and "prettified".

Additional Context

It is likely going to be challenging to port the entire AirBnb ruleset into this. Not only is that ruleset large, as indicated, there may be a number of areas that would require conversion. For that reason, this ticket should mainly cover those lint rules that are the biggest bang for the buck. Those that are easy to import with minimal changes and particularly those rules that would have the most meaningful impact, long term. This will require some consideration on the part of the developer implementing these rules and may deviate from the original AirBnb style.

In short: Use your best judgement