1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | module.exports = {
|
13 | meta: {
|
14 | type: "suggestion",
|
15 |
|
16 | docs: {
|
17 | description: "disallow octal literals",
|
18 | category: "Best Practices",
|
19 | recommended: true,
|
20 | url: "https://eslint.org/docs/rules/no-octal"
|
21 | },
|
22 |
|
23 | schema: []
|
24 | },
|
25 |
|
26 | create(context) {
|
27 |
|
28 | return {
|
29 |
|
30 | Literal(node) {
|
31 | if (typeof node.value === "number" && /^0[0-9]/u.test(node.raw)) {
|
32 | context.report({ node, message: "Octal literals should not be used." });
|
33 | }
|
34 | }
|
35 | };
|
36 |
|
37 | }
|
38 | };
|