My team is currently in the process of refactoring our codebase, utilizing ESLint to pinpoint any lint errors within our files. Initially, we set high thresholds in one .eslintrc file and have been gradually decreasing these limits as we enhance specific files in our codebase. For instance, our "max-statements" threshold was originally 99 statements, but we aim to lower it to 20 statements. Therefore, we incrementally adjust the threshold from 99 to 98 to 97, and so on until a lint error surfaces, indicating which file requires further refactoring.
However, this approach does not fully address our issues. To illustrate, suppose a new controller is added containing 45 statements. Although this count falls beneath our current threshold (due to our bottleneck file having 99 statements), it still exceeds our target threshold of 20 statements.
Our ideal scenario would involve receiving errors for any lint violations surpassing our current thresholds and warnings for those exceeding our target thresholds. This method would generate a comprehensive list of offending files, allowing us to prioritize fixing the most severe violations first. An example configuration could be:
// inside .eslintrc
....
"rules": {
"max-statements": [2, 99],
"max-statements": [1, 20]
}
....
In this setup, warnings would indicate files with over 20 statements while errors would highlight those with more than 99 statements.
While attempting to implement the above settings, I encountered an issue where the 1st "max-statements" rule was overridden by the 2nd, leading to complications in achieving the desired outcome.
Could anyone provide guidance on how to achieve the solution I've described?