@bud-tools/eslint-plugin-bt-plugin v0.9.0
eslint-plugin-bt-plugin
Helpful eslint rules for bt plugins.
Use these rules in a bt plugin
yarn add --dev eslint-plugin-bt-plugin
Then, in your plugin's .eslintrc.js
, add "plugin:bt-plugin/recommended"
to your extends
property.
example:
module.exports = {
extends: ['@bud-tools/eslint-config-budtools-typescript', 'plugin:@bud-tools/bt-plugin/recommended'],
};
To override how an individual rules behaves, add the plugin name and change the its rules
value.
plugins: ['bt-plugin'],
rules: {
'bt-plugin/no-hardcoded-messages': 'error'
}
Use these rules to migrate a plugin based on btdxCommand to use btCommand
These eslint rules are experimental and cause significant code changes. Please use with caution and test changes thoroughly
yarn add @bud-tools/bt-plugins-core
yarn add --dev @bud-tools/eslint-plugin-bt-plugin
migration
includes all of the recommended
rules, so you don't have to include both
module.exports = {
extends: ['@bud-tools/eslint-config-budtools-typescript', 'plugin:@bud-tools/bt-plugin/migration'],
};
Rules
πΌ Configurations enabled in.\
β οΈ Configurations set to warn in.\
π Set in the library
configuration.\
βοΈ Set in the migration
configuration.\
β
Set in the recommended
configuration.\
π§ Automatically fixable by the --fix
CLI option.\
π‘ Manually fixable by editor suggestions.
NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Description | πΌ | β οΈ | π§ | π‘ |
---|---|---|---|---|---|
command-example | Ensure commands have a summary, description, and examples | βοΈ β | |||
command-summary | Ensure commands have a summary | βοΈ β | π§ | ||
dash-o | Warn on a flag that uses -o | βοΈ β | |||
encourage-alias-deprecation | Commands and flags aliases probably want to deprecate their old names to provide more warnings to users | βοΈ | π§ | π‘ | |
flag-case | Enforce lowercase kebab-case flag names | βοΈ β | π§ | ||
flag-cross-references | Enforce flag cross references for dependOn,exclusive,exactlyOne | βοΈ β | |||
flag-min-max-default | Enforce that flags with min/max values have a default value | βοΈ β | |||
flag-summary | Enforce that flags have a summary property and that longDescription is renamed to description | βοΈ β | π§ | ||
get-connection-with-version | Calls to getConnection should pass in a version | βοΈ β | |||
id-flag-suggestions | Create better budtoolsId flags with length and startsWith properties | βοΈ β | π§ | π‘ | |
no-args-parse-without-strict-false | If you parse args/argv, the class should have strict set to false | βοΈ β | π§ | ||
no-builtin-flags | Handling for btdxCommand's flags.builtin | βοΈ | π§ | ||
no-deprecated-properties | Removes non-existent properties left over from BtdxCommand | βοΈ | π§ | ||
no-duplicate-short-characters | Prevent duplicate use of short characters or conflicts between aliases and flags | βοΈ β | |||
no-filepath-flags | Change filepath flag to file flag | π§ | |||
no-h-short-char | Do not allow creation of a flag with short char -h | βοΈ β | |||
no-hardcoded-messages-commands | Use loaded messages and separate files for messages | βοΈ β | |||
no-hardcoded-messages-flags | Use loaded messages and separate files for messages | βοΈ β | |||
no-id-flags | Change Id flag to budtoolsId | βοΈ | π§ | ||
no-json-flag | Do not allow creation of json flag | βοΈ β | |||
no-missing-messages | Checks core Messages usage for correct usage of named messages and message tokens | π βοΈ β | |||
no-number-flags | Change number flag to integer | π§ | |||
no-oclif-flags-command-import | Change import of flags and Command from oclif to use bt-plugins-core | βοΈ β | π§ | ||
no-btdx-command-import | Change import and base class from BtdxCommand to btCommand | βοΈ | π§ | ||
no-split-examples | Arrays of messags should use getMessages instead of getMessage followed by EOL splitting | βοΈ β | π§ | ||
no-this-flags | Fix references to this.org (property on BtdxCommand) | βοΈ | π§ | π‘ | |
no-this-org | Fix references to this.org (property on BtdxCommand) | βοΈ | π§ | π‘ | |
no-this-ux | BtCommand does not have a ux property | βοΈ | π§ | ||
no-time-flags | Migrate time flags to Flags.duration | βοΈ | π§ | ||
no-unnecessary-aliases | Mark when an alias is unnecessary because its only an order permutation, not really a different name | βοΈ β | π§ | ||
no-unnecessary-properties | Boolean properties are false by default, so they should not be set to false | βοΈ β | π§ | ||
no-username-properties | Convert requiresUsername and supportusername to username flags | βοΈ | π§ | ||
read-only-properties | Class-level static properties, like flags or descriptions, should be marked read-only | βοΈ β | π§ | ||
run-matches-class-type | The return type of the run method should match the Type passed to btCommand | βοΈ β | π§ | ||
btdx-flags-property | Change flag definitions to BtCommand version | βοΈ | π§ | ||
should-parse-flags | The run method should call this.parse when there are flags | βοΈ | π§ | ||
use-bt-command-flags | Use Flags export from bt-plugins-core | βοΈ | π§ |