Skip to content

Commit a526080

Browse files
authored
fix(xo): linting problems (#156)
1 parent c13d7c7 commit a526080

File tree

5 files changed

+38
-43
lines changed

5 files changed

+38
-43
lines changed

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
COMMIT_MAIL=my.commit@mail.com
33

44
# (https://app.zeplin.io/profile/developer)
5-
# (https://github.com/db-ui/base/blob/feat-zeplin-token-generation/scripts/zeplin-styleguide.js#L7)
5+
# (https://github.com/db-ui/base/blob/feat-zeplin-token-generation/scripts/zeplin-styleguide.mjs#L7)
66
# This access token is necessary to fetch the json from zeplin
77
DEVELOPER_ZEPLIN_ACCESS_TOKEN=TODO

.xo-config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"import/extensions": 0,
66
"max-depth": 0,
77
"n/prefer-global/process": 0,
8-
"max-params": 0,
9-
"unicorn/prefer-top-level-await": 0
8+
"max-params": 0
109
}
1110
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"pl:install": "patternlab install --config ./patternlab-config.json",
3434
"pl:serve": "patternlab serve --config ./patternlab-config.json",
3535
"pl:version": "patternlab --version",
36-
"zeplin:tokens": "node scripts/zeplin-styleguide.js"
36+
"zeplin:tokens": "node scripts/zeplin-styleguide.mjs"
3737
},
3838
"license": "Apache-2.0",
3939
"dependencies": {

scripts/tailwind-config-generator.mjs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
import * as process from 'node:process';
66
import * as fs from 'node:fs';
77

8-
const run = async () => {
9-
const defaultConfig = process.argv[2];
8+
const defaultConfig = process.argv[2];
109

11-
const internal = process.argv[3];
10+
const internal = process.argv[3];
1211

13-
let configFile = `
12+
let configFile = `
1413
const tokens = require('${
1514
internal ? './' : '@db-ui/base/build/tailwind/'
1615
}tailwind-tokens.json')
@@ -31,14 +30,11 @@ const run = async () => {
3130
};
3231
`;
3332

34-
if (defaultConfig === 'default') {
35-
configFile = `module.exports = require('@db-ui/base/build/tailwind/tailwind.config')`;
36-
}
33+
if (defaultConfig === 'default') {
34+
configFile = `module.exports = require('@db-ui/base/build/tailwind/tailwind.config')`;
35+
}
3736

38-
fs.writeFileSync(
39-
`${internal ? './build/tailwind' : '.'}/tailwind.config.js`,
40-
configFile
41-
);
42-
};
43-
44-
run();
37+
await fs.writeFileSync(
38+
`${internal ? './build/tailwind' : '.'}/tailwind.config.js`,
39+
configFile
40+
);

scripts/zeplin-styleguide.js renamed to scripts/zeplin-styleguide.mjs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
require('dotenv').config();
2-
const FS = require('node:fs');
3-
const { ZeplinApi, Configuration } = require('@zeplin/sdk');
1+
import * as fs from 'node:fs';
2+
import * as dotenv from 'dotenv'; // See https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
3+
import { ZeplinApi, Configuration } from '@zeplin/sdk';
4+
5+
dotenv.config();
46

57
const zeplin = new ZeplinApi(
68
new Configuration({
@@ -191,26 +193,24 @@ const convertSpacings = (data) => {
191193
data.spacing = mergeData(spacings);
192194
};
193195

194-
(async () => {
195-
try {
196-
const { data } = await zeplin.designTokens.getStyleguideDesignTokens(
197-
'63037ab49bdcb913c9228718'
198-
);
196+
try {
197+
const { data } = await zeplin.designTokens.getStyleguideDesignTokens(
198+
'63037ab49bdcb913c9228718'
199+
);
199200

200-
convertColors(data);
201-
convertTextStyles(data);
202-
convertSpacings(data);
203-
204-
FS.writeFileSync(
205-
'./tokens/zeplin.json',
206-
JSON.stringify({
207-
spacing: data.spacing,
208-
sizing: data.sizing,
209-
typography: data.textStyles,
210-
colors: data.colors
211-
})
212-
);
213-
} catch (error) {
214-
console.error(error);
215-
}
216-
})();
201+
convertColors(data);
202+
convertTextStyles(data);
203+
convertSpacings(data);
204+
205+
fs.writeFileSync(
206+
'./tokens/zeplin.json',
207+
JSON.stringify({
208+
spacing: data.spacing,
209+
sizing: data.sizing,
210+
typography: data.textStyles,
211+
colors: data.colors
212+
})
213+
);
214+
} catch (error) {
215+
console.error(error);
216+
}

0 commit comments

Comments
 (0)