Skip to content

Commit 0044ace

Browse files
committed
style: apply prettier
1 parent acd0daf commit 0044ace

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/CONTROL_CHARACTERS.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const CONTROL_CHARACTERS = [
108108
];
109109

110110
// except
111-
const INVALID_CONTROL_CHARACTERS = CONTROL_CHARACTERS.filter(CONTROL_CHARACTER => {
111+
const INVALID_CONTROL_CHARACTERS = CONTROL_CHARACTERS.filter((CONTROL_CHARACTER) => {
112112
const code = CONTROL_CHARACTER.code;
113113
return code !== "\r" && code !== "\n" && code !== "\t";
114114
});

src/textlint-rule-no-invalid-control-character.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import { CONTROL_CHARACTERS } from "./CONTROL_CHARACTERS";
99
* @param {string} str
1010
* @return {string}
1111
*/
12-
const unicodeEscape = str => {
13-
return str.replace(/./g, c => {
12+
const unicodeEscape = (str) => {
13+
return str.replace(/./g, (c) => {
1414
return `\\u${`000${c.charCodeAt(0).toString(16)}`.substr(-4)}`;
1515
});
1616
};
1717

18-
const getName = char => {
19-
const matchChar = CONTROL_CHARACTERS.find(CONTROL_CHARACTER => CONTROL_CHARACTER.code === char);
18+
const getName = (char) => {
19+
const matchChar = CONTROL_CHARACTERS.find((CONTROL_CHARACTER) => CONTROL_CHARACTER.code === char);
2020
if (!matchChar) {
2121
return "";
2222
}
@@ -37,19 +37,19 @@ const reporter = (context, options = {}) => {
3737
const allow = options.allow || DEFAULT_OPTION.allow;
3838
const checkCode = options.checkCode !== undefined ? options.checkCode : DEFAULT_OPTION.checkCode;
3939
const checkImage = options.checkImage !== undefined ? options.checkImage : DEFAULT_OPTION.checkImage;
40-
const checkNode = node => {
40+
const checkNode = (node) => {
4141
const text = getSource(node);
4242
// Ignore \r \n \t
4343
const controlCharacterPattern = /([\x00-\x08\x0B\x0C\x0E-\x1F\x7F])/g;
4444
/**
4545
* @type {Array<{match:string, sub:string[], index:number}>}
4646
*/
4747
const results = execall(controlCharacterPattern, text);
48-
results.forEach(result => {
48+
results.forEach((result) => {
4949
const index = result.index;
5050
const char = result.sub[0];
5151
// if allow the `char`, ignore it
52-
if (allow.some(allowChar => allowChar === char)) {
52+
if (allow.some((allowChar) => allowChar === char)) {
5353
return;
5454
}
5555
const name = getName(char);

test/textlint-rule-no-invalid-control-character-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const tester = new TextLintTester();
55
const rule = require("../src/textlint-rule-no-invalid-control-character");
66
import { INVALID_CONTROL_CHARACTERS } from "../src/CONTROL_CHARACTERS";
77

8-
const invalid = INVALID_CONTROL_CHARACTERS.map(character => {
8+
const invalid = INVALID_CONTROL_CHARACTERS.map((character) => {
99
return {
1010
text: `${character.code}:${character.name}`,
1111
output: `:${character.name}`,

0 commit comments

Comments
 (0)