Skip to content

Commit 09d6d55

Browse files
authored
feat: migrate from TSLint to ESLint (#217)
1 parent cbb1cfb commit 09d6d55

File tree

5 files changed

+101
-115
lines changed

5 files changed

+101
-115
lines changed

index.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
type Options = {
1+
interface Options {
22
elementDelimiter: string;
33
modifierDelimiter: string;
44
namespace: string | string[];
55
namespaceDelimiter: string;
6-
};
6+
}
77

88
type PartialOptions = Partial<Options>;
99

@@ -19,7 +19,7 @@ export function setup({
1919
modifierDelimiter,
2020
namespace,
2121
namespaceDelimiter,
22-
}: PartialOptions) {
22+
}: PartialOptions): void {
2323
if (elementDelimiter) {
2424
defaultOptions.elementDelimiter = elementDelimiter;
2525
}
@@ -34,11 +34,13 @@ export function setup({
3434
}
3535
}
3636

37-
type Modifiers = {
37+
interface Modifiers {
3838
[key: string]: boolean | null | undefined;
39-
};
39+
}
40+
41+
type BemBlockFunction = (elementOrModifiers?: string | Modifiers, modifiers?: Modifiers) => string;
4042

41-
export default function bem(block: string, options: PartialOptions = {}) {
43+
export default function bem(block: string, options: PartialOptions = {}): BemBlockFunction {
4244
const { elementDelimiter, modifierDelimiter, namespace, namespaceDelimiter } = {
4345
...defaultOptions,
4446
...options,
@@ -51,7 +53,7 @@ export default function bem(block: string, options: PartialOptions = {}) {
5153

5254
const baseBlock = `${namespaces}${block}`;
5355

54-
return function bemBlock(elementOrModifiers?: string | Modifiers, modifiers?: Modifiers) {
56+
return function bemBlock(elementOrModifiers, modifiers) {
5557
let base = baseBlock;
5658

5759
if (!elementOrModifiers) {

package-lock.json

+78-94
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+12-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"test": "nyc tape -r ts-node/register test.ts",
2828
"test:coverage": "nyc report --reporter=html && opn coverage/index.html",
2929
"test:coverage:report": "nyc report --reporter=lcov && npx codecov",
30-
"lint:ts": "tslint -p tsconfig.test.json",
30+
"lint:ts": "eslint --ignore-path .gitignore --ext .ts .",
3131
"lint:ts:fix": "prettier --write \"**/*.ts\" && npm run lint:ts -- --fix",
3232
"lint:md": "remark . --frail",
3333
"lint:md:fix": "remark . --output",
@@ -41,14 +41,15 @@
4141
},
4242
"devDependencies": {
4343
"@types/tape": "^4.2.33",
44+
"@typescript-eslint/eslint-plugin": "^1.4.2",
45+
"eslint": "^5.14.1",
46+
"eslint-config-prettier": "^4.0.0",
4447
"nyc": "^13.3.0",
4548
"opn-cli": "^4.0.0",
4649
"rimraf": "^2.6.3",
4750
"tape": "^4.10.1",
4851
"terser": "^3.16.1",
4952
"ts-node": "^8.0.2",
50-
"tslint": "^5.13.0",
51-
"tslint-config-prettier": "^1.18.0",
5253
"typescript": "^3.3.3333",
5354
"ybiq": "^7.3.0"
5455
},
@@ -61,7 +62,7 @@
6162
"lint-staged": {
6263
"linters": {
6364
"*.ts": [
64-
"tslint --fix",
65+
"eslint --ext .ts --fix",
6566
"git add"
6667
],
6768
"*.md": [
@@ -152,5 +153,12 @@
152153
]
153154
]
154155
}
156+
},
157+
"eslintConfig": {
158+
"extends": [
159+
"plugin:@typescript-eslint/recommended",
160+
"prettier",
161+
"prettier/@typescript-eslint"
162+
]
155163
}
156164
}

sideci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
linter:
2-
tslint:
2+
eslint:
33
npm_install: "development"
4+
ext: ".ts"

tslint.json

-9
This file was deleted.

0 commit comments

Comments
 (0)