Skip to content

Commit

Permalink
fix lint (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
gossi authored Sep 26, 2021
1 parent 6392e19 commit 736e2dc
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 55 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ on:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Setup Tools
uses: volta-cli/action@v1
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn install
- run: yarn lint

test:
runs-on: ubuntu-latest

Expand All @@ -17,6 +31,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"scripts": {
"clean": "rm -rf dist",
"dts": "tsc -d --declarationDir dist/ --outDir tmp/ src/index.ts; rm -rf tmp/",
"dts": "tsc --emitDeclarationOnly",
"start": "yarn build:rollup -w",
"build": "yarn clean && yarn build:rollup",
"build:rollup": "rollup -c",
Expand Down Expand Up @@ -75,7 +75,7 @@
"@types/jest-expect-message": "^1.0.3",
"@types/lodash.isempty": "^4.4.6",
"@types/mock-fs": "^4.13.1",
"@types/node-fetch": "^3.0.2",
"@types/node-fetch": "~2.5.12",
"@typescript-eslint/eslint-plugin": "^4.31.2",
"@typescript-eslint/parser": "^4.31.2",
"chokidar": "^3.5.2",
Expand Down
7 changes: 5 additions & 2 deletions src/tools/figma/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default class FigmaParser {
this.processedStyles.add(style);
const token = this.createTokenFromStyle(style, node);
token.description = style.description;
token.type = this.getCategoryFromType(type);
token.type = this.getTypefromStyle(type);
token.data = this.referencer.findData(style.name, type.toLowerCase());

// see if we have a reference
Expand Down Expand Up @@ -154,6 +154,9 @@ export default class FigmaParser {

return token;
}

// eslint-disable-next-line unicorn/no-useless-undefined
return undefined;
}

private getShadowsFromEffect(effects: Effect[]) {
Expand Down Expand Up @@ -227,7 +230,7 @@ export default class FigmaParser {
return this.config.getValueFromText?.(node) ?? node.characters;
}

private getCategoryFromType(type: string) {
private getTypefromStyle(type: string) {
// 'FILL' | 'STROKE' | 'TEXT' | 'EFFECT' | 'GRID'
switch (type.toLowerCase()) {
case 'fill':
Expand Down
3 changes: 3 additions & 0 deletions src/tools/figma/referencers/theemo-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export default class TheemoPluginReferencer implements Referencer {
if (nodeReference) {
return (nodeReference[type as keyof RefNode] as StyleRef)?.from.name;
}

// eslint-disable-next-line unicorn/no-useless-undefined
return undefined;
}

findData(name: string, type: string): Data | undefined {
Expand Down
6 changes: 6 additions & 0 deletions src/tools/style-dictionary/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export default class StyleDictionaryBuilder {
if (file) {
return requireFile(file) as TheemoConfig;
}

// eslint-disable-next-line unicorn/no-useless-undefined
return undefined;
}

private findConfig() {
Expand All @@ -51,5 +54,8 @@ export default class StyleDictionaryBuilder {
return file;
}
}

// eslint-disable-next-line unicorn/no-useless-undefined
return undefined;
}
}
49 changes: 28 additions & 21 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,41 @@
],
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"importHelpers": true,
"declaration": true,
"sourceMap": true,

"baseUrl": "./",
"rootDir": "./src",
"alwaysStrict": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true,
"module": "esnext",
"moduleResolution": "node",
"baseUrl": "./",
"downlevelIteration": true,
"isolatedModules": true,
"resolveJsonModule": true,
"paths": {
"*": [
"types/*",
"node_modules/*"
]
},
"esModuleInterop": true

"esModuleInterop": true,
"isolatedModules": true,

"declaration": true,
"declarationDir": "./dist",
"downlevelIteration": true,
"sourceMap": true,

"importHelpers": true,

"alwaysStrict": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,

"skipLibCheck": true
}
}
36 changes: 6 additions & 30 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1468,12 +1468,13 @@
dependencies:
"@types/node" "*"

"@types/node-fetch@^3.0.2":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-3.0.3.tgz#9d969c9a748e841554a40ee435d26e53fa3ee899"
integrity sha512-HhggYPH5N+AQe/OmN6fmhKmRRt2XuNJow+R3pQwJxOOF9GuwM7O2mheyGeIrs5MOIeNjDEdgdoyHBOrFeJBR3g==
"@types/node-fetch@~2.5.12":
version "2.5.12"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66"
integrity sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==
dependencies:
node-fetch "*"
"@types/node" "*"
form-data "^3.0.0"

"@types/node@*":
version "15.6.0"
Expand Down Expand Up @@ -2699,11 +2700,6 @@ cssstyle@^2.3.0:
dependencies:
cssom "~0.3.6"

data-uri-to-buffer@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz#594b8973938c5bc2c33046535785341abc4f3636"
integrity sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==

data-urls@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b"
Expand Down Expand Up @@ -3636,13 +3632,6 @@ fb-watchman@^2.0.0:
dependencies:
bser "2.1.1"

fetch-blob@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.1.2.tgz#6bc438675f3851ecea51758ac91f6a1cd1bacabd"
integrity sha512-hunJbvy/6OLjCD0uuhLdp0mMPzP/yd2ssd1t2FCJsaA7wkWhpbp9xfuNVpv7Ll4jFhzp6T4LAupSiV9uOeg0VQ==
dependencies:
web-streams-polyfill "^3.0.3"

figgy-pudding@^3.5.1:
version "3.5.2"
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e"
Expand Down Expand Up @@ -5846,14 +5835,6 @@ no-case@^3.0.4:
lower-case "^2.0.2"
tslib "^2.0.3"

node-fetch@*:
version "3.0.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.0.0.tgz#79da7146a520036f2c5f644e4a26095f17e411ea"
integrity sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
dependencies:
data-uri-to-buffer "^3.0.1"
fetch-blob "^3.1.2"

node-fetch@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
Expand Down Expand Up @@ -7898,11 +7879,6 @@ wcwidth@^1.0.1:
dependencies:
defaults "^1.0.3"

web-streams-polyfill@^3.0.3:
version "3.1.1"
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.1.1.tgz#1516f2d4ea8f1bdbfed15eb65cb2df87098c8364"
integrity sha512-Czi3fG883e96T4DLEPRvufrF2ydhOOW1+1a6c3gNjH2aIh50DNFBdfwh2AKoOf1rXvpvavAoA11Qdq9+BKjE0Q==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
Expand Down

0 comments on commit 736e2dc

Please sign in to comment.