Viewing version 0.7.0. Open the latest package page.
custom_lint_builder
0.7.0A package to help writing custom linters
Readme
About
custom_lint_builder is a package that should be associated with custom_lint
for defining custom_lint plugins.
If a package wants to access classes such as LintRule or Assist but do
not want to make a custom_lint plugin (such as for exposing new utilities
for plugin authors), then use custom_lint_core instead.
Using cutom_lint_builder is reserved to plugin authors. Depending it on it
will tell custom_lint that your package is a plugin, and therefore will try to
run it.
See custom_lint for more informations
Changelog
0.7.0 - 2024-10-27
custom_lint --fixand the generated "Fix all " assists now correctly handle imports.- Now supports a broad number of analyzer version.
0.6.10 - 2024-10-10
custom_lintupgraded to0.6.10custom_lint_coreupgraded to0.6.10
0.6.9 - 2024-10-09
custom_lintupgraded to0.6.9custom_lint_coreupgraded to0.6.9
0.6.8 - 2024-10-08
- Fix CI
0.6.7 - 2024-09-08
custom_lintupgraded to0.6.7
0.6.6 - 2024-09-08
custom_lintupgraded to0.6.6
0.6.5 - 2024-08-15
- Upgraded to analyzer ^6.6.0. This is a quick fix to unblock the stable Flutter channel. A more robust fix will come later.
- Fixed a bug where isSuperTypeOf throws if the element is null (thanks to @charlescyt)
0.6.4 - 2024-03-16
custom_lintupgraded to0.6.4
0.6.3 - 2024-03-16
custom_lintupgraded to0.6.3custom_lint_coreupgraded to0.6.3
0.6.2 - 2024-02-19
- Upgrade analyzer to support 6.4.0
- Fix null exception when using
TypeChecker.isSuperTypeOf(thanks to @charlescyt)
0.6.1 - 2024-02-14
custom_lint_coreupgraded to0.6.1
0.6.0 - 2024-02-04
- Bumped minimum Dart SDK to 3.0.0
- Added support for
--fix
0.5.14 - 2024-02-03
custom_lint_coreupgraded to0.5.14
0.5.13 - 2024-02-03
custom_lint_coreupgraded to0.5.13
0.5.12 - 2024-02-02
custom_lint_coreupgraded to0.5.12
0.5.11 - 2024-01-27
- Added support for
analysis_options.yamlthat are nt at the root of the project (thanks to @mrgnhnt96)
0.5.10 - 2024-01-26
custom_lint_coreupgraded to0.5.10
0.5.9 - 2024-01-26
custom_lint_coreupgraded to0.5.9
0.5.8 - 2024-01-09
// ignorecomments now correctly respect indentation when they are inserted (thanks to @PiotrRogulski)
0.5.7 - 2023-11-20
custom_lintupgraded to0.5.7custom_lint_coreupgraded to0.5.7
0.5.6 - 2023-10-30
custom_lintupgraded to0.5.6custom_lint_coreupgraded to0.5.6
0.5.5 - 2023-10-26
custom_lintupgraded to0.5.5custom_lint_coreupgraded to0.5.5
0.5.4 - 2023-10-20
custom_lintupgraded to0.5.4custom_lint_coreupgraded to0.5.4
0.5.3 - 2023-08-29
custom_lintupgraded to0.5.3custom_lint_coreupgraded to0.5.3
0.5.2 - 2023-08-16
- Support both analyzer 5.12.0 and 6.0.0 at the same time.
- Attempt at fixing the windows crash
0.5.0 - 2023-06-21
custom_lintupgraded to0.5.0custom_lint_coreupgraded to0.5.0
0.4.0 - 2023-05-12
- Report uncaught exceptions inside
context.addPostRunCallback - Added support for analyzer 5.12.0
0.3.4 - 2023-04-19
custom_lintupgraded to0.3.4custom_lint_coreupgraded to0.3.4
0.3.3 - 2023-04-06
- Upgraded
analyzerto>=5.7.0 <5.11.0 LintRuleNodeRegistryand other AstVisitor-like now are based offGeneralizingAstVisitorinstead ofGeneralizingAstVisitor- Exposes the Pubspec in CustomLintContext
0.3.2 - 2023-03-09
custom_lintupgraded to0.3.2custom_lint_coreupgraded to0.3.2
0.3.1 - 2023-03-09
custom_lint_coreupgraded to0.3.1
0.3.0 - 2023-03-09
- Fix FileSystemException thrown when deleting a file
- Update analyzer to >=5.7.0 <5.8.0
- Upgrade dependencies
0.2.12
Upgrade custom_lint
0.2.11
- Fixes
LintCode.urlno-longer showing-up in the IDE - Fix quick-fixes not working on the last offset of an analysis error
- Bump minimum Dart SDK to
sdk: ">=2.19.0 <3.0.0"
0.2.10
Fix filesToAnalyze only working on the file name instead of the file path.
0.2.9
Fix TypeChecker.fromPackage not always return true when it should
0.2.8
Fix exception thrown by TypeChecker.isExactlyType if DartType.element is null.
0.2.7
Extract LintRule and similar other utilities to a separate package: custom_lint_core.
custom_lint_builder re-exports custom_lint_core, so the utilities are still available.
0.2.6
Fix infinite loop on InconsistentAnalysisException
0.2.5
- Fix custom_lint not correctly killing sub-processes when the IDE stops custom_lint.
- Export incorrectly unexported
matcherNormalizedPrioritizedSourceChangeSnapshot
0.2.4
- Added
<DartLintRule/DartFix/DartAssist>.testRun&testAnalyzeAndRunmethods, which enables programmatically running a lint/assist/fix against a Dart file. - Added
matcherNormalizedPrioritizedSourceChangeSnapshottest matcher, which allows checking that a list of file edits matches against a JSON snapshot of the changes.
0.2.3
Fixes InconsistentAnalysisException
0.2.2
Fixes an exception thrown when a project contains images.
0.2.1
Add TypeChecker.every and TypeChecker.package
0.2.0
Large Breaking change
This new version introduces large changes to how lints/fixes/assists are defined.
Long story short, besides the createPlugin method, the entire syntax changed.
See the readme, examples, and docs around how to use the new syntax.
The new syntax has multiple benefits:
-
It is now possible to enable/disable lints inside the
analysis_options.yamlas followed:# optional include: path/to/another/analysis_options.yaml custom_lint: rules: # enable a lint rule - my_lint_rule # A lint rule that is explicitly disabled - another_lint_rule: falseEnabling/disabling lints is supported by default with the new syntax. Nothing to do~
-
Performance improvement when using a large number of lints. The workload of analyzing files is now shared between lints.
-
The new syntax makes the code simpler to maintain. Before, the
PluginBase.getLintsrapidly ended-up doing too much. Now, it is simple to split the implementation in multiple bits
0.1.2-dev
Do some internal refactoring as an attempt to fix #60
0.1.1
- Fix an issue where plugins were hot-reloaded when the file analyzed changed.
- Optimized analysis such that
PluginBase.getLints()is theorically not reinvoked unless the file analyzed changed.
0.1.0
-
Breaking: The plugin entrypoint has moved.
Plugins no-longer should define a/bin/custom_lint.dartfile. Instead they should define a/lib/<my_package_name>.dart -
Breaking: The plugin entrypoint is modified. Plugins no-longer define a "main", but instead define a
createPluginfunction:Before:
// /bin/custom_lint.dart void main(List<String> args, SendPort sendPort) { startPlugin(sendPort, MyPlugin()); }After:
// /lib/<my_package_name.dart MyPlugin createPlugin() => MyPlugin(); -
Add assist support. Inside your plugins, you can now override
handleGetAssists:import 'package:analyzer_plugin/protocol/protocol_generated.dart' as analyzer_plugin; class MyPlugin extends PluginBase { // ... Future<analyzer_plugin.EditGetAssistsResult> handleGetAssists( ResolvedUnitResult resolvedUnitResult, { required int offset, required int length, }) async { // TODO return some assists for the given offset } }
0.0.16
Fix expect_lint not working if the file doesn't contain any lint.
0.0.15
-
Custom_lint now has a built-in mechanism for testing lints. Simply write a file that should contain lints for your plugin. Then, using a syntax similar to
// ignore, write a// expect_lint: codein the line before your lint:// expect_lint: riverpod_final_provider var provider = Provider(...);When doing this, there are two possible cases:
- The line after the
expect_lintcorrectly contains the expected lint.
In that case, the lint is ignored (similarly to if we used// ignore) - The next line does not contain the lint.
In that case, the
expect_lintcomment will have an error.
This allows testing your plugins by simply running
custom_linton your test/example folder. Then, if any expected lint is missing, the command will fail. But if your plugin correctly emits the lint, the command will succeed. - The line after the
-
Upgrade analyzer/analzer_plugin
0.0.14
- Fix custom_lint not working in the IDE
0.0.13
- Add debugger and hot-reload support (Thanks to @TimWhiting)
- Correctly respect
excludeobtains from the analysis_options.yaml - Fix
dart analyzeincorrectly failing due to showing the "plugin is starting" lint.
0.0.12
Upgrade dependencies
0.0.11
Upgrade dependencies
0.0.10
- Upgrade Riverpod to 2.0.0
- Fix deprecation errors with analyzer
0.0.9
- Lint fixes can now be used when placing the cursor on the last character of a lint
- improve pub score
0.0.8
Allow lints to emit fixes
0.0.7
Fix a bug where the custom_lint command line may not list all lints
0.0.6
feat!: getLints now is expected to return a Stream<Lint> instead of Iterable<Lint>
fix: a bug where the lints shown by the IDE could get out of sync with the actual content of the file
0.0.4
- Fixed a bug where the command line could show IDE-only meant for debugging
0.0.3
PluginBase.getLints now receive a ResolvedUnitResult instead of a LibraryElement.
0.0.2
-
Compilation errors are now visible within the
pubspec.yamlof applications that are using the plugin. -
Plugins that are currently loading are now highlighted inside the
pubspec.yamlof applications that are using the plugin. -
If a plugin throws when trying to analyze a Dart file, the IDE will now show the exception at the top of the analyzed file.
-
Compilation errors, exceptions and prints are now accessible within a log file (
custom_lint.log) inside applications using the plugin.
0.0.1
Initial release
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'custom_lint_builder:0.7.0'pubspec.yaml
name: custom_lint_builder
version: 0.7.0
description: A package to help writing custom linters
repository: https://github.com/invertase/dart_custom_lint
environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
analyzer: ^6.6.0
analyzer_plugin: ^0.11.0
collection: ^1.16.0
# Using tight constraints as custom_lint_builder communicate with each-other
# using a specific contract
custom_lint: 0.7.0
# Using tight constraints as custom_lint_builder communicate with each-other
# using a specific contract
custom_lint_core: 0.7.0
# Using loose constraint to support a range of analyzer versions.
custom_lint_visitor: ^1.0.0
glob: ^2.1.1
hotreloader: ">=3.0.5 <5.0.0"
meta: ^1.7.0
package_config: ^2.1.0
path: ^1.8.0
pubspec_parse: ^1.2.0
rxdart: ^0.28.0
dev_dependencies:
test: ^1.22.2
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.0.1 | Cached · Upstream SHA-256 matched | Download | 64d54fb0…953311 |
| 0.0.2 | Cached · Upstream SHA-256 matched | Download | c8825857…3684c1 |
| 0.0.3 | Cached · Upstream SHA-256 matched | Download | dcb08297…701784 |
| 0.0.4 | Cached · Upstream SHA-256 matched | Download | 67f56de3…581047 |
| 0.0.5 | Cached · Upstream SHA-256 matched | Download | 7203c87e…d578a1 |
| 0.0.6 | Cached · Upstream SHA-256 matched | Download | c4ddf5b1…5ae104 |
| 0.0.7 | Cached · Upstream SHA-256 matched | Download | 0f968009…667048 |
| 0.0.8 | Cached · Upstream SHA-256 matched | Download | 4852f747…c99fe1 |
| 0.0.9 | Cached · Upstream SHA-256 matched | Download | 2bd64739…4938c5 |
| 0.0.9+1 | Cached · Upstream SHA-256 matched | Download | 887618e7…0932f8 |
| 0.0.10 | Cached · Upstream SHA-256 matched | Download | f12a483d…32eb39 |
| 0.0.11 | Cached · Upstream SHA-256 matched | Download | ec395792…b02412 |
| 0.0.12 | Cached · Upstream SHA-256 matched | Download | 1d3ea795…60d5ac |
| 0.0.13 | Cached · Upstream SHA-256 matched | Download | e0b39192…2c8674 |
| 0.0.14 | Cached · Upstream SHA-256 matched | Download | eb212f06…5acc9e |
| 0.0.15 | Cached · Upstream SHA-256 matched | Download | 421d3571…21b1cd |
| 0.0.16 | Cached · Upstream SHA-256 matched | Download | 77b1c2d8…338152 |
| 0.1.0 | Cached · Upstream SHA-256 matched | Download | f23d1643…d39bae |
| 0.1.1 | Cached · Upstream SHA-256 matched | Download | 97178028…1c70da |
| 0.1.2-dev | Cached · Upstream SHA-256 matched | Download | d9e54b58…8bec0d |
| 0.2.0 | Cached · Upstream SHA-256 matched | Download | 2d80e767…2b1e01 |
| 0.2.1 | Cached · Upstream SHA-256 matched | Download | 3846bcce…b98385 |
| 0.2.2 | Cached · Upstream SHA-256 matched | Download | 2256407c…110dbc |
| 0.2.3 | Cached · Upstream SHA-256 matched | Download | 682de21d…2c4296 |
| 0.2.4 | Cached · Upstream SHA-256 matched | Download | 8707b878…39165b |
| 0.2.5 | Cached · Upstream SHA-256 matched | Download | 4d441fa4…bbb8c1 |
| 0.2.6 | Cached · Upstream SHA-256 matched | Download | 7ce7b01b…7ae485 |
| 0.2.7 | Cached · Upstream SHA-256 matched | Download | 2bf40337…79fb23 |
| 0.2.8 | Cached · Upstream SHA-256 matched | Download | d8466a8c…cd59e2 |
| 0.2.9 | Cached · Upstream SHA-256 matched | Download | 8a863ca3…ccd834 |
| 0.2.10 | Cached · Upstream SHA-256 matched | Download | b58a4d9a…caa8bf |
| 0.2.11 | Cached · Upstream SHA-256 matched | Download | 0b245895…3d7780 |
| 0.2.12 | Cached · Upstream SHA-256 matched | Download | 4f4d640f…51a61c |
| 0.3.1 | Cached · Upstream SHA-256 matched | Download | 5f4f144b…6d1f99 |
| 0.3.2 | Cached · Upstream SHA-256 matched | Download | 5d472a90…3ffee4 |
| 0.3.3 | Cached · Upstream SHA-256 matched | Download | 0f77cd46…7d1916 |
| 0.3.4 | Cached · Upstream SHA-256 matched | Download | 6b5e20a2…deec9f |
| 0.4.0 | Cached · Upstream SHA-256 matched | Download | 73d09c98…0b6d06 |
| 0.5.0 | Cached · Upstream SHA-256 matched | Download | f1430048…4143bf |
| 0.5.1-dev | Cached · Upstream SHA-256 matched | Download | 6038e46d…59a6d0 |
| 0.5.1 | Cached · Upstream SHA-256 matched | Download | be0e44c2…d6b78a |
| 0.5.2 | Cached · Upstream SHA-256 matched | Download | fe5ba0da…f6afe1 |
| 0.5.3 | Cached · Upstream SHA-256 matched | Download | 3537d502…f2be72 |
| 0.5.4 | Cached · Upstream SHA-256 matched | Download | b3f3a36a…5f3cd9 |
| 0.5.5 | Cached · Upstream SHA-256 matched | Download | cdaa0174…b0d043 |
| 0.5.6 | Cached · Upstream SHA-256 matched | Download | c6f656a4…a97883 |
| 0.5.7 | Cached · Upstream SHA-256 matched | Download | dfcfa987…9d6418 |
| 0.5.8 | Cached · Upstream SHA-256 matched | Download | 8df6634b…c6288d |
| 0.5.9 | Cached · Upstream SHA-256 matched | Download | 6e23ca15…732ec1 |
| 0.5.10 | Cached · Upstream SHA-256 matched | Download | badc07d7…ee8410 |
| 0.5.11 | Cached · Upstream SHA-256 matched | Download | 7d0b0942…73d5fc |
| 0.5.12 | Cached · Upstream SHA-256 matched | Download | c6c13c7a…cfe1f2 |
| 0.5.13 | Cached · Upstream SHA-256 matched | Download | 119b5bff…41dc1f |
| 0.5.14 | Cached · Upstream SHA-256 matched | Download | 0d48e002…cf3b19 |
| 0.6.0 | Cached · Upstream SHA-256 matched | Download | 9cdd9987…c4baef |
| 0.6.1 | Cached · Upstream SHA-256 matched | Download | 3a14687f…ff1d54 |
| 0.6.2 | Cached · Upstream SHA-256 matched | Download | 4c0aed2a…5bbbd6 |
| 0.6.3 | Cached · Upstream SHA-256 matched | Download | 1ec64c9b…b30337 |
| 0.6.4 | Cached · Upstream SHA-256 matched | Download | d7dc41e7…7615a9 |
| 0.6.5 | Cached · Upstream SHA-256 matched | Download | d9e5bb63…1621b3 |
| 0.6.6 | Cached · Upstream SHA-256 matched | Download | 534cbf2f…bfc864 |
| 0.6.7 | Cached · Upstream SHA-256 matched | Download | ba2f90ff…a40a21 |
| 0.6.8 | Cached · Upstream SHA-256 matched | Download | c3d82779…bd50ac |
| 0.6.9 | Cached · Upstream SHA-256 matched | Download | 515d42d6…1c486a |
| 0.6.10 | Cached · Upstream SHA-256 matched | Download | 5a95eff1…511d78 |
| 0.7.0 | Cached · Upstream SHA-256 matched | Download | 42cdc419…234759 |
| 0.7.1 | Cached · Upstream SHA-256 matched | Download | 8cc525c7…2835fe |
| 0.7.2 | Cached · Upstream SHA-256 matched | Download | e2694113…309d3b |
| 0.7.3 | Cached · Upstream SHA-256 matched | Download | e4235b9d…6df32d |
| 0.7.4 | Cached · Upstream SHA-256 matched | Download | 009b4b69…42eb7b |
| 0.7.5 | Cached · Upstream SHA-256 matched | Download | 107e0a43…a4c228 |
| 0.7.6 | Cached · Upstream SHA-256 matched | Download | 6cdc8e87…655414 |
| 0.7.7 | Cached · Upstream SHA-256 matched | Download | 638891a5…7fcf24 |
| 0.8.0 | Cached · Upstream SHA-256 matched | Download | cc5532d5…5c9e52 |
| 0.8.1 | Cached · Upstream SHA-256 matched | Download | 1128db6f…a32072 |
Dependencies
analyzer "^6.6.0"
analyzer_plugin "^0.11.0"
collection "^1.16.0"
custom_lint "0.7.0"
custom_lint_core "0.7.0"
custom_lint_visitor "^1.0.0"
glob "^2.1.1"
hotreloader "\u003e=3.0.5 \u003c5.0.0"
meta "^1.7.0"
package_config "^2.1.0"
path "^1.8.0"
pubspec_parse "^1.2.0"
rxdart "^0.28.0"