For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt, and this page is available as Markdown at https://rslint.rs/rules/eslint/no-script-url.md.
close

no-script-url

Added in v0.4.2

Configuration

rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-script-url': 'error',
    },
  },
]);

Rule Details

Disallow javascript: URLs.

Using javascript: URLs is considered by some as a form of eval. Code passed in javascript: URLs has to be parsed and evaluated by the browser in the same way that eval is processed.

Examples of incorrect code for this rule:

location.href = 'javascript:void(0)';

location.href = `javascript:void(0)`;

Examples of correct code for this rule:

location.href = 'https://example.com';

Original Documentation