Commit Graph

630 Commits

Author SHA1 Message Date
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
Jeroen Engels
f5b689b0ec Make fixes a Maybe, so that we can know whether fixes were provided 2019-08-03 14:02:49 +02:00
Jeroen Engels
007472a29c Add Lint.Rule.withFixes 2019-08-03 11:43:32 +02:00
Jeroen Engels
24e71626cf Create the Lint.Fix module, to handle fixes to the source code 2019-08-03 01:19:12 +02:00
Jeroen Engels
bc4b7fef00 Get some very simple fixing 2019-08-03 00:21:14 +02:00
Jeroen Engels
4831498a57 Add travis badge 2019-08-01 09:30:40 +02:00
Jeroen Engels
d60662279c SImplify test command
"elm make --docs" already run compiler checks, no need for an additional
"elm make"
2019-08-01 09:20:23 +02:00
Jeroen Engels
c1c0eafb01 Run tests in Travis 2019-07-31 21:01:48 +02:00
Jeroen Engels
e2f669a337 Run elm-format when running testing 2019-07-31 21:00:36 +02:00
Jeroen Engels
8327eb4280 Update Lint.Test to API changes
It was missing the changes on LintError being opaque and the file name 
being renamed to path
2019-07-31 21:00:16 +02:00
Jeroen Engels
a8c3d2cc71 Remove unused dependency in example 2019-07-31 09:51:59 +02:00
Jeroen Engels
f102759274 Upgrade dependencies 2019-07-31 09:49:29 +02:00
Jeroen Engels
5d297822ca Store the module name in the error, to send it to the reporter 2019-07-31 00:50:35 +02:00
Jeroen Engels
4b9e2ae8d9 Rename the file's name field to path
This is a more accurate name for a field that is like 
"src/Folder/File.elm"
2019-07-31 00:08:16 +02:00
Jeroen Engels
24f52dd660 Clean: Move functions around 2019-07-30 23:29:39 +02:00
Jeroen Engels
02985ff109 Example: Use reporter from elm-lint-reporter
Basically, the contents of Reporter and Text were moved there. This will 
be useful to share the reporter with the CLI.
2019-07-30 23:18:52 +02:00
Jeroen Engels
e937feb91f Example: Fix source code and linting errors being out of sync 2019-07-30 21:01:38 +02:00
Jeroen Engels
50b0c6ad23 Copy the Reporter from the CLI 2019-07-30 21:01:38 +02:00
Jeroen Engels
a67321e0a0 Turn Lint.LintError into an opaque type
This will help make the type extensible later on without breaking 
changes
2019-07-29 23:56:23 +02:00
Jeroen Engels
daf16f11d5 Make the colors of the reporter by the same as the compiler's 2019-07-29 19:44:48 +02:00
Jeroen Engels
a845cbd86d Make lintSource always return a list, not a result 2019-07-28 21:16:01 +02:00
Jeroen Engels
e1146c634f Reword parts of the README 2019-07-28 19:36:12 +02:00
Jeroen Engels
58e4ef5954 Remove the FAQ and move out some questions 2019-07-28 19:30:34 +02:00
Jeroen Engels
6763340cb8 Add section on when to write or enable a rule 2019-07-28 19:20:23 +02:00
Jeroen Engels
faf7ca3efc Enforce that docs are valid when running tests 2019-07-28 17:43:56 +02:00
Jeroen Engels
00215346ca Fix a bunch of typos about "it's" 2019-07-28 17:37:21 +02:00
Jeroen Engels
cff014d5ad Show the linting errors in the example like we do in the terminal 2019-07-28 17:37:21 +02:00
Jeroen Engels
2274505ebc Rewrite the part about messages in "what makes a good rule" 2019-07-28 17:37:21 +02:00
Jeroen Engels
061fca8274 Check that the details are correct 2019-07-28 10:27:46 +02:00
Jeroen Engels
e27ea65b1a Add details in tests 2019-07-28 10:27:46 +02:00
Jeroen Engels
68b3b72f8d Update calls to Rule.error in documentation 2019-07-28 10:27:46 +02:00
Jeroen Engels
d593bae052 Add details to the message of every rule
This will make it easier to have helpful explanations and suggestions
like the Elm compiler does
2019-07-28 10:27:46 +02:00