Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub struct ArrayCallbackReturn {
declare_oxc_lint!(
/// ### What it does
///
/// Enforce return statements in callbacks of array methods
/// Enforce return statements in callbacks of array methods.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub struct GroupedAccessorPairsConfig {
declare_oxc_lint!(
/// ### What it does
///
/// Require grouped accessor pairs in object literals and classes
/// Require grouped accessor pairs in object literals and classes.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Default for MaxClassesPerFileConfig {
declare_oxc_lint!(
/// ### What it does
///
/// Enforce a maximum number of classes per file
/// Enforce a maximum number of classes per file.
///
/// ### Why is this bad?
///
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_linter/src/rules/eslint/no_alert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ pub struct NoAlert;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow the use of alert, confirm, and prompt
/// Disallow the use of `alert`, `confirm`, and `prompt`.
///
/// ### Why is this bad?
///
/// JavaScript’s alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation.
/// Furthermore, alert is often used while debugging code, which should be removed before deployment to production.
/// JavaScript’s `alert`, `confirm`, and `prompt` functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation.
/// Furthermore, `alert` is often used while debugging code, which should be removed before deployment to production.
///
/// ### Examples
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_bitwise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl std::ops::Deref for NoBitwise {
declare_oxc_lint!(
/// ### What it does
///
/// Disallow bitwise operators
/// Disallow bitwise operators.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_cond_assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum NoCondAssignConfig {
declare_oxc_lint!(
/// ### What it does
///
/// Disallow assignment operators in conditional expressions
/// Disallow assignment operators in conditional expressions.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct NoConstantBinaryExpression;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow expressions where the operation doesn't affect the value
/// Disallow expressions where the operation doesn't affect the value.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct NoConstantCondition {
declare_oxc_lint!(
/// ### What it does
///
/// Disallow constant expressions in conditions
/// Disallow constant expressions in conditions.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct NoConstructorReturn;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow returning value from constructor
/// Disallow returning value from constructor.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_continue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct NoContinue;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow `continue` statements
/// Disallow `continue` statements.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct NoDebugger;
declare_oxc_lint!(
/// ### What it does
///
/// Checks for usage of the `debugger` statement
/// Checks for usage of the `debugger` statement.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_dupe_else_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct NoDupeElseIf;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow duplicate conditions in if-else-if chains
/// Disallow duplicate conditions in if-else-if chains.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_duplicate_case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct NoDuplicateCase;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow duplicate case labels
/// Disallow duplicate case labels.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_else_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Default for NoElseReturn {
declare_oxc_lint!(
/// ### What it does
///
/// Disallow `else` blocks after `return` statements in `if` statements
/// Disallow `else` blocks after `return` statements in `if` statements.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct NoEmpty {
declare_oxc_lint!(
/// ### What it does
///
/// Disallows empty block statements
/// Disallows empty block statements.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct NoEmptyCharacterClass;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow empty character classes in regular expressions
/// Disallow empty character classes in regular expressions.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct NoEmptyStaticBlock;
declare_oxc_lint!(
/// ### What it does
///
/// Disallows the usages of empty static blocks
/// Disallows the usages of empty static blocks.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_ex_assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct NoExAssign;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow reassigning exceptions in catch clauses
/// Disallow reassigning exceptions in catch clauses.
///
/// ### Why is this bad?
///
Expand Down
10 changes: 5 additions & 5 deletions crates/oxc_linter/src/rules/eslint/no_extra_bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ pub struct NoExtraBind;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow unnecessary calls to .bind()
/// Disallow unnecessary calls to `.bind()`.
///
/// ### Why is this bad?
///
/// This rule is aimed at avoiding the unnecessary use of bind()
/// and as such will warn whenever an immediately-invoked function expression (IIFE) is using bind()
/// and doesn’t have an appropriate this value.
/// This rule won’t flag usage of bind() that includes function argument binding.
/// This rule is aimed at avoiding the unnecessary use of `bind()`
/// and as such will warn whenever an immediately-invoked function expression (IIFE) is using `bind()`
/// and doesn’t have an appropriate `this` value.
/// This rule won’t flag usage of `bind()` that includes function argument binding.
///
/// ### Examples
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_lonely_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct NoLonelyIf;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow `if` statements as the only statement in `else` blocks
/// Disallow `if` statements as the only statement in `else` blocks.
///
/// ### Why is this bad?
///
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/eslint/no_new_wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ pub struct NoNewWrappers;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow `new` operators with the `String`, `Number`, and `Boolean` objects
/// Disallow `new` operators with the `String`, `Number`, and `Boolean` objects.
///
/// ### Why is this bad?
///
/// The first problem is that primitive wrapper objects are, in fact,
/// objects. That means typeof will return `"object"` instead of `"string"`,
/// objects. That means `typeof` will return `"object"` instead of `"string"`,
/// `"number"`, or `"boolean"`. The second problem comes with boolean
/// objects. Every object is truthy, that means an instance of `Boolean`
/// always resolves to `true` even when its actual value is `false`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct NoNonoctalDecimalEscape;
declare_oxc_lint!(
/// ### What it does
///
/// This rule disallows \8 and \9 escape sequences in string literals
/// This rule disallows \8 and \9 escape sequences in string literals.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct NoObjectConstructor;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow calls to the Object constructor without an argument
/// Disallow calls to the Object constructor without an argument.
///
/// ### Why is this bad?
///
Expand Down
14 changes: 7 additions & 7 deletions crates/oxc_linter/src/rules/eslint/no_prototype_builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ pub struct NoPrototypeBuiltins;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow calling some Object.prototype methods directly on objects
/// Disallow calling some `Object.prototype` methods directly on objects.
///
/// ### Why is this bad?
///
/// In ECMAScript 5.1, Object.create was added, which enables the creation of objects with a specified [[Prototype]].
/// Object.create(null) is a common pattern used to create objects that will be used as a Map.
/// This can lead to errors when it is assumed that objects will have properties from Object.prototype. This rule prevents calling some Object.prototype methods directly from an object.
/// Additionally, objects can have properties that shadow the builtins on Object.prototype, potentially causing unintended behavior or denial-of-service security vulnerabilities.
/// For example, it would be unsafe for a webserver to parse JSON input from a client and call hasOwnProperty directly on the resulting object, because a malicious client could send a JSON value like {"hasOwnProperty": 1} and cause the server to crash.
/// In ECMAScript 5.1, `Object.create` was added, which enables the creation of objects with a specified [[Prototype]].
/// `Object.create(null)` is a common pattern used to create objects that will be used as a Map.
/// This can lead to errors when it is assumed that objects will have properties from `Object.prototype`. This rule prevents calling some `Object.prototype` methods directly from an object.
/// Additionally, objects can have properties that shadow the builtins on `Object.prototype`, potentially causing unintended behavior or denial-of-service security vulnerabilities.
/// For example, it would be unsafe for a webserver to parse JSON input from a client and call `hasOwnProperty` directly on the resulting object, because a malicious client could send a JSON value like {"hasOwnProperty": 1} and cause the server to crash.
///
/// To avoid subtle bugs like this, it’s better to always call these methods from Object.prototype. For example, foo.hasOwnProperty("bar") should be replaced with Object.prototype.hasOwnProperty.call(foo, "bar").
/// To avoid subtle bugs like this, it’s better to always call these methods from `Object.prototype`. For example, `foo.hasOwnProperty("bar")` should be replaced with `Object.prototype.hasOwnProperty.call(foo, "bar")`.
///
/// ### Examples
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_script_url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct NoScriptUrl;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow javascript: urls
/// Disallow `javascript:` URLs.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_self_compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct NoSelfCompare;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow comparisons where both sides are exactly the same
/// Disallow comparisons where both sides are exactly the same.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ declare_oxc_lint!(
/// var undefined = "foo";
/// ```
///
/// Then any code used within the same scope would not get the global undefined, but rather the
/// Then any code used within the same scope would not get the global `undefined`, but rather the
/// local version with a very different meaning.
///
/// ### Examples
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_ternary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct NoTernary;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow ternary operators
/// Disallow ternary operators.
///
/// ### Why is this bad?
///
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/eslint/no_unassigned_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ pub struct NoUnassignedVars;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow let or var variables that are read but never assigned
/// Disallow let or var variables that are read but never assigned.
///
/// ### Why is this bad?
///
/// This rule flags let or var declarations that are never assigned a value but are still read or used in the code.
/// Since these variables will always be undefined, their usage is likely a programming mistake.
/// Since these variables will always be `undefined`, their usage is likely a programming mistake.
///
/// ### Examples
///
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_linter/src/rules/eslint/no_undefined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ fn no_undefined_diagnostic(span: Span) -> OxcDiagnostic {
declare_oxc_lint!(
/// ### What it does
///
/// Disallow the use of `undefined` as an identifier
/// Disallow the use of `undefined` as an identifier.
///
/// ### Why is this bad?
///
/// Using undefined directly can lead to bugs, since it can be shadowed or overwritten in JavaScript.
/// It's safer and more intentional to use null or rely on implicit undefined (e.g., missing return) to avoid accidental issues.
/// Using `undefined` directly can lead to bugs, since it can be shadowed or overwritten in JavaScript.
/// It's safer and more intentional to use `null` or rely on implicit `undefined` (e.g., missing return) to avoid accidental issues.
///
/// ### Examples
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Default for NoUnneededTernary {
declare_oxc_lint!(
/// ### What it does
///
/// Disallow ternary operators when simpler alternatives exist
/// Disallow ternary operators when simpler alternatives exist.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ pub struct NoUnsafeOptionalChaining {
declare_oxc_lint!(
/// ### What it does
///
/// Disallow use of optional chaining in contexts where the undefined value is not allowed
/// Disallow use of optional chaining in contexts where the `undefined` value is not allowed.
///
/// ### Why is this bad?
///
/// The optional chaining (`?.`) expression can short-circuit with a return value of undefined.
/// The optional chaining (`?.`) expression can short-circuit with a return value of `undefined`.
/// Therefore, treating an evaluated optional chaining expression as a function, object, number, etc.,
/// can cause TypeError or unexpected results. For example:
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct NoUnusedPrivateClassMembers;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow unused private class members
/// Disallow unused private class members.
///
/// ### Why is this bad?
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_useless_catch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct NoUselessCatch;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow unnecessary catch clauses
/// Disallow unnecessary catch clauses.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Default for NoUselessComputedKey {
declare_oxc_lint!(
/// ### What it does
///
/// Disallow unnecessary computed property keys in objects and classes
/// Disallow unnecessary computed property keys in objects and classes.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct PreferDestructuring {
declare_oxc_lint!(
/// ### What it does
///
/// Require destructuring from arrays and/or objects
/// Require destructuring from arrays and/or objects.
///
/// ### Why is this bad?
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ fn prefer_exponentian_operator_diagnostic(span: Span) -> OxcDiagnostic {
declare_oxc_lint!(
/// ### What it does
///
/// Disallow the use of Math.pow in favor of the ** operator
/// Disallow the use of `Math.pow` in favor of the `**` operator.
///
/// ### Why is this bad?
///
/// Introduced in ES2016, the infix exponentiation operator ** is an alternative for the
/// standard Math.pow function. Infix notation is considered to be more readable and thus more
/// Introduced in ES2016, the infix exponentiation operator `**` is an alternative for the
/// standard `Math.pow` function. Infix notation is considered to be more readable and thus more
/// preferable than the function notation.
///
/// ### Examples
Expand Down
Loading
Loading