mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(linter): change some rules pedantic and improve help message (#1112)
This commit is contained in:
parent
144c881be5
commit
407e406f86
4 changed files with 8 additions and 8 deletions
|
|
@ -44,7 +44,7 @@ declare_oxc_lint!(
|
|||
/// var barIsEnumerable = foo.propertyIsEnumerable("bar");
|
||||
/// ```
|
||||
NoPrototypeBuiltins,
|
||||
correctness
|
||||
pedantic
|
||||
);
|
||||
|
||||
const DISALLOWED_PROPS: &[&str; 3] = &["hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable"];
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ declare_oxc_lint!(
|
|||
/// [1,2,3] instanceof Array;
|
||||
/// ```
|
||||
NoInstanceofArray,
|
||||
correctness
|
||||
pedantic
|
||||
);
|
||||
|
||||
impl Rule for NoInstanceofArray {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use crate::{context::LintContext, fixer::Fix, rule::Rule, AstNode};
|
|||
|
||||
#[derive(Debug, Error, Diagnostic)]
|
||||
#[error("eslint-plugin-unicorn(require-number-to-fixed-digits-argument): Number method .toFixed() should have an argument")]
|
||||
#[diagnostic(severity(warning), help("Pass an argument to .toFixed() method."))]
|
||||
#[diagnostic(severity(warning), help("It's better to make it clear what the value of the digits argument is when calling Number#toFixed(), instead of relying on the default value of 0."))]
|
||||
struct RequireNumberToFixedDigitsArgumentDiagnostic(#[label] pub Span);
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
|
|
@ -34,7 +34,7 @@ declare_oxc_lint!(
|
|||
/// number.toFixed();
|
||||
/// ```
|
||||
RequireNumberToFixedDigitsArgument,
|
||||
correctness
|
||||
pedantic
|
||||
);
|
||||
|
||||
impl Rule for RequireNumberToFixedDigitsArgument {
|
||||
|
|
|
|||
|
|
@ -7,27 +7,27 @@ expression: require_number_to_fixed_digits_argument
|
|||
1 │ const string = number.toFixed();
|
||||
· ──
|
||||
╰────
|
||||
help: Pass an argument to .toFixed() method.
|
||||
help: It's better to make it clear what the value of the digits argument is when calling Number#toFixed(), instead of relying on the default value of 0.
|
||||
|
||||
⚠ eslint-plugin-unicorn(require-number-to-fixed-digits-argument): Number method .toFixed() should have an argument
|
||||
╭─[require_number_to_fixed_digits_argument.tsx:1:1]
|
||||
1 │ const string = number.toFixed( /* comment */ );
|
||||
· ─────────────────
|
||||
╰────
|
||||
help: Pass an argument to .toFixed() method.
|
||||
help: It's better to make it clear what the value of the digits argument is when calling Number#toFixed(), instead of relying on the default value of 0.
|
||||
|
||||
⚠ eslint-plugin-unicorn(require-number-to-fixed-digits-argument): Number method .toFixed() should have an argument
|
||||
╭─[require_number_to_fixed_digits_argument.tsx:1:1]
|
||||
1 │ Number(1).toFixed()
|
||||
· ──
|
||||
╰────
|
||||
help: Pass an argument to .toFixed() method.
|
||||
help: It's better to make it clear what the value of the digits argument is when calling Number#toFixed(), instead of relying on the default value of 0.
|
||||
|
||||
⚠ eslint-plugin-unicorn(require-number-to-fixed-digits-argument): Number method .toFixed() should have an argument
|
||||
╭─[require_number_to_fixed_digits_argument.tsx:1:1]
|
||||
1 │ const bigNumber = new BigNumber(1); const string = bigNumber.toFixed();
|
||||
· ──
|
||||
╰────
|
||||
help: Pass an argument to .toFixed() method.
|
||||
help: It's better to make it clear what the value of the digits argument is when calling Number#toFixed(), instead of relying on the default value of 0.
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue