feat(linter): change some rules pedantic and improve help message (#1112)

This commit is contained in:
Boshen 2023-10-30 17:42:15 +08:00 committed by GitHub
parent 144c881be5
commit 407e406f86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View file

@ -44,7 +44,7 @@ declare_oxc_lint!(
/// var barIsEnumerable = foo.propertyIsEnumerable("bar");
/// ```
NoPrototypeBuiltins,
correctness
pedantic
);
const DISALLOWED_PROPS: &[&str; 3] = &["hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable"];

View file

@ -32,7 +32,7 @@ declare_oxc_lint!(
/// [1,2,3] instanceof Array;
/// ```
NoInstanceofArray,
correctness
pedantic
);
impl Rule for NoInstanceofArray {

View file

@ -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 {

View file

@ -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.