Skip to content

Commit 4186905

Browse files
committed
test(Lint): Migrate to eslint
1 parent e97fe8b commit 4186905

File tree

5 files changed

+825
-337
lines changed

5 files changed

+825
-337
lines changed

.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
extends: "@cablanchard",
3+
rules: {
4+
"no-console": ["error", { allow: ["warn", "error"] }]
5+
}
6+
};

lib/index.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ const SPACE_REGEX = /\s+/gi;
8787
/**
8888
* Drop all spaces and uppercase
8989
*/
90-
const sanitize = (s: string): string => {
91-
return s.replace(SPACE_REGEX, "").toUpperCase();
92-
};
90+
const sanitize = (s: string): string =>
91+
s.replace(SPACE_REGEX, "").toUpperCase();
9392

94-
const matchOn = (s: string, regex: RegExp): RegExpMatchArray | null => {
95-
return sanitize(s).match(regex);
96-
};
93+
const matchOn = (s: string, regex: RegExp): RegExpMatchArray | null =>
94+
sanitize(s).match(regex);
9795

9896
const incodeRegex = /\d[a-z]{2}$/i;
9997
const validOutcodeRegex = /^[a-z]{1,2}\d[a-z\d]?$/i;
@@ -111,9 +109,8 @@ const VALIDATION_REGEX = /^[a-z]{1,2}\d[a-z\d]?\s*\d[a-z]{2}$/i;
111109
* - AA9 9AA
112110
* - AA99 9AA
113111
*/
114-
const isValid: Validator = postcode => {
115-
return postcode.match(VALIDATION_REGEX) !== null;
116-
};
112+
const isValid: Validator = postcode =>
113+
postcode.match(VALIDATION_REGEX) !== null;
117114

118115
/**
119116
* Returns a normalised postcode string (i.e. uppercased and properly spaced)

0 commit comments

Comments
 (0)