Commit Graph

461 Commits

Author SHA1 Message Date
Jeroen Engels
8a98cc6040 Example: Adapt to new project argument for Lint.lint 2019-08-22 19:56:40 +02:00
Jeroen Engels
61fe5ea013 Add explanation as to why the Lint.Project module is available 2019-08-22 19:49:48 +02:00
Jeroen Engels
50a84c7433 Add an alias to Elm.Project.Project
We should rename the whole module, but in the meantime, this makes the 
docs a bit better
2019-08-22 19:49:48 +02:00
Jeroen Engels
9c284690d7 Add runWithProjectData to add ability to test rules that look at elm.json 2019-08-22 19:49:48 +02:00
Jeroen Engels
8c9a7c5f85 Replace withprojectVisitor by withElmJsonVisitor
This way, we'll be able to
- Optimize for rules that don't need some of the project details, by not 
loading them in the first place
- Read at first glance which project's data the rule will look at
2019-08-22 19:49:48 +02:00
Jeroen Engels
b730fec914 Add Project to the arguments of a rule 2019-08-22 19:49:48 +02:00
Jeroen Engels
c35cce2a90 Add withProjectVisitor function to go through the elm.json file 2019-08-22 19:49:48 +02:00
Jeroen Engels
85e688dfc0 Rewrite functions of List.Extra into our own module
This is to remove a dependency from the project
2019-08-22 19:48:46 +02:00
Jeroen Engels
94a87319f7 Rewrite functions of List.Extra into our own module
This is to remove a dependency from the project
2019-08-22 19:48:46 +02:00
Jeroen Engels
ddaea22eab Move range manipulations fns out of Lint.Fix and into the rule that uses them 2019-08-22 19:48:46 +02:00
Jeroen Engels
6b3c635bb5 Reword the project's short description 2019-08-22 12:00:17 +02:00
Jeroen Engels
5433526b2f Explain why we require providing the fix result in test error messages 2019-08-22 11:57:14 +02:00
Jeroen Engels
3a05b37fd3 Lint.Rule: Move withFixes into its own section in the documentation 2019-08-22 11:43:16 +02:00
Jeroen Engels
c1562aa81b Remove the rules from the README, and write why there are no built-in rules 2019-08-22 11:42:43 +02:00
Jeroen Engels
9463d89a32 Add comments in the example of the "write your own rule" section 2019-08-22 11:04:59 +02:00
Jeroen Engels
354a876ce0 Rework documentation about configuration 2019-08-22 10:43:53 +02:00
Jeroen Engels
0d39bcf2d0 Rename Lint.Fix.Result to Lint.Fix.FixResult
This is to avoid confusion with the core Result type when seeing 
signatures like `a : b -> Result`
2019-08-22 09:35:24 +02:00
Jeroen Engels
86f3a24a52 Adapt to the addition of background colors in elm-lint-reporter 2019-08-21 22:15:25 +02:00
Jeroen Engels
50e3ccdb36 Forbid calling withFinalEvaluation if the Schema has no visitors 2019-08-21 18:12:56 +02:00
Jeroen Engels
afe531946e Rename Lint.LintError to Lint.Error 2019-08-19 17:29:23 +02:00
Jeroen Engels
7c90ffe38a Rename Lint.lintSource to Lint.lint 2019-08-19 17:15:10 +02:00
Jeroen Engels
845d462c78 Re-organize documentation in Lint.elm 2019-08-19 17:09:39 +02:00
Jeroen Engels
dc0fbefde6 Remove unused parameter 2019-08-19 17:08:28 +02:00
Jeroen Engels
574eb55023 Ignore .coverage in Git 2019-08-19 17:06:27 +02:00
Jeroen Engels
7aa09c1b82 Handle GLSLExpression as a node that can't hold an expression
A node of type GLSLExpression does not hold contain children
expressions, contrary to what i understood before. This change should
remove the confusion around that.
2019-08-19 17:06:05 +02:00
Jeroen Engels
2c38878a6d Autofix all unused variables in NoUnusedVariables 2019-08-19 16:13:45 +02:00
Jeroen Engels
aa27b91141 Adapt to Report.formatReport API change 2019-08-19 11:24:52 +02:00
Jeroen Engels
8963ea42ac Rename Lint.fixes to Lint.errorFixes 2019-08-18 23:58:11 +02:00
Jeroen Engels
8fa510458e Fail applying a fix if ranges of the fixes overlap 2019-08-18 23:32:30 +02:00
Jeroen Engels
b70c9f4e5d Fix example code 2019-08-09 19:31:03 +02:00
Jeroen Engels
50f631c47c Add commented out tests for rangeUpUntil 2019-08-09 19:16:23 +02:00
Jeroen Engels
55fb6b71bb Improve NoUnusedVariables handles deleting the last declaration in a let in 2019-08-09 19:07:06 +02:00
Jeroen Engels
ac93b84586 Bump elm-format to v0.8.2 2019-08-09 10:35:09 +02:00
Jeroen Engels
3b93133ada Fail applying a fix if the result becomes unparsable 2019-08-08 22:01:44 +02:00
Jeroen Engels
b7bbaff013 Fail the test with a helpful error message when fix does not change anything 2019-08-08 22:01:44 +02:00
Jeroen Engels
72fbe07fdd Add a short section about test titles 2019-08-07 20:58:24 +02:00
Jeroen Engels
b877693cdf Add documentation for Fix 2019-08-06 09:31:57 +02:00
Jeroen Engels
55d17ee5ef Replace use Node.value and Node.range by pattern matching
I just noticed that the constructor for Node was exposed, and this can 
make the code easier to write.
2019-08-06 09:31:57 +02:00
Jeroen Engels
919467fee6 Add a way to check in tests that the fixed code is correct 2019-08-06 09:31:57 +02:00
Jeroen Engels
b973e90936 Change fixedSource to a list of fixes in the different errors 2019-08-06 09:31:57 +02:00
Jeroen Engels
4eb024ef2e Make Lint.Fix.fix return a value that shows whether it was successful 2019-08-06 09:31:57 +02:00
Jeroen Engels
7f6580d1fd Tiny clean up/refactor in the applyReplace function 2019-08-06 09:31:57 +02:00
Jeroen Engels
c5d706f739 Perf: Do not split source into lines at every fix 2019-08-06 09:31:57 +02:00
Jeroen Engels
9e6160f8a6 Add ability to fix something on multiple lines 2019-08-06 09:31:57 +02:00
Jeroen Engels
76f0a8aaf2 Add tests for applying multiple fixes on a file 2019-08-06 09:31:57 +02:00
Jeroen Engels
9283ee5d8b Expose Lint.Fix as part of the public API 2019-08-06 09:31:57 +02:00
Jeroen Engels
330b1a1a7b Add tests for applying fixes on a single line 2019-08-06 09:31:57 +02:00
Jeroen Engels
d20396773e Move mergeRanges to Lint.Fix
Also add tests and documentation
2019-08-04 11:43:08 +02:00
Jeroen Engels
df840de3d6 NoUnusedVariable: Automatic fix a var of type Variable by removing it 2019-08-04 11:14:16 +02:00
Jeroen Engels
1ac02ebde6 Make fixes a lazy function
This prevents having to do a heavy computation when it is not needed.
2019-08-03 14:02:49 +02:00