# no-clear-text-protocols

Rule `sonarjs/no-clear-text-protocols`. Clear-text protocols should not be used

- Source: sonarjs
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 6.2M weekly downloads of presets that enable it
- Trend: +62.1% last quarter
- Rank: #1245 by reach, #546 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/no-clear-text-protocols` | yes | no | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-5332/) |

## Code examples

### Correct: the rule accepts this

```js
url = "https://example.com";
url = "sftp://anonymous@example.com";
url = "ssh://anonymous@example.com";
```

```js
const nodemailer = require("nodemailer");
let transporter = nodemailer.createTransport({
  secure: true,
  requireTLS: true,
  port: 465,
  secured: true
});
```

```js
var Client = require('ftp');
var c = new Client();
c.connect({
  'secure': true
});
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "sonarjs/no-clear-text-protocols": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [SonarJS recommended](https://lintradar.dev/presets/sonarjs-recommended.md) | ESLint | `eslint-plugin-sonarjs` | 230 | 6.2M | +62.1% |

## Related rules

- [sonarjs/no-case-label-in-switch](https://lintradar.dev/rules/sonarjs/no-case-label-in-switch.md): "switch" statements should not contain non-case labels
- [sonarjs/no-code-after-done](https://lintradar.dev/rules/sonarjs/no-code-after-done.md): Tests should not execute any code after "done()" is called
- [sonarjs/no-async-constructor](https://lintradar.dev/rules/sonarjs/no-async-constructor.md): Constructors should not contain asynchronous operations
- [sonarjs/no-collection-size-mischeck](https://lintradar.dev/rules/sonarjs/no-collection-size-mischeck.md): Collection size and array length comparisons should make sense
- [sonarjs/no-associative-arrays](https://lintradar.dev/rules/sonarjs/no-associative-arrays.md): Array indexes should be numeric
- [sonarjs/no-control-regex](https://lintradar.dev/rules/sonarjs/no-control-regex.md): Regular expressions should not contain control characters

---

Web page: https://lintradar.dev/rules/sonarjs/no-clear-text-protocols. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
