Skip to content

Commit c4367dc

Browse files
committed
eslint fix
1 parent 4319454 commit c4367dc

File tree

11 files changed

+130
-128
lines changed

11 files changed

+130
-128
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/root/src/
2+
/root/es/
3+
/root/lib/
4+
/root/svg/

gulpfile.ts

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
import { series, parallel } from 'gulp';
2-
import { clean } from './utils/clean';
3-
import { copy } from './utils/copy';
1+
import { series, parallel } from 'gulp'
2+
import { clean } from './utils/clean'
3+
import { copy } from './utils/copy'
44

55
export default series(
66

7-
// Cleaning 'src','svg','es','lib' before copying SVGs from 'EOS-Icons'
8-
clean(['src','svg','es','lib']),
9-
10-
// Running all the tasks of copying SVGs from 'EOS-Icons' in parallel
11-
parallel(
12-
13-
copy({
14-
from: ['node_modules/eos-icons/svg/*.svg'],
15-
toDir: 'svg/filled'
16-
}),
17-
18-
copy({
19-
from: ['node_modules/eos-icons/svg/material/*.svg'],
20-
toDir: 'svg/filled'
21-
}),
22-
23-
copy({
24-
from: ['node_modules/eos-icons/animated-svg/*.svg'],
25-
toDir: 'svg/animated'
26-
}),
27-
28-
copy({
29-
from: ['node_modules/eos-icons/svg-outlined/*.svg'],
30-
toDir: 'svg/outlined'
31-
}),
32-
33-
copy({
34-
from: ['node_modules/eos-icons/svg-outlined/material/*.svg'],
35-
toDir: 'svg/outlined'
36-
}),
37-
38-
copy({
39-
from: ['template/index.ts'],
40-
toDir: 'src/'
41-
}),
42-
43-
copy({
44-
from: ['utils/helper.ts'],
45-
toDir: 'src/'
46-
})
47-
)
48-
);
7+
// Cleaning 'src','svg','es','lib' before copying SVGs from 'EOS-Icons'
8+
clean(['src', 'svg', 'es', 'lib']),
9+
10+
// Running all the tasks of copying SVGs from 'EOS-Icons' in parallel
11+
parallel(
12+
13+
copy({
14+
from: ['node_modules/eos-icons/svg/*.svg'],
15+
toDir: 'svg/filled'
16+
}),
17+
18+
copy({
19+
from: ['node_modules/eos-icons/svg/material/*.svg'],
20+
toDir: 'svg/filled'
21+
}),
22+
23+
copy({
24+
from: ['node_modules/eos-icons/animated-svg/*.svg'],
25+
toDir: 'svg/animated'
26+
}),
27+
28+
copy({
29+
from: ['node_modules/eos-icons/svg-outlined/*.svg'],
30+
toDir: 'svg/outlined'
31+
}),
32+
33+
copy({
34+
from: ['node_modules/eos-icons/svg-outlined/material/*.svg'],
35+
toDir: 'svg/outlined'
36+
}),
37+
38+
copy({
39+
from: ['template/index.ts'],
40+
toDir: 'src/'
41+
}),
42+
43+
copy({
44+
from: ['utils/helper.ts'],
45+
toDir: 'src/'
46+
})
47+
)
48+
)

interface/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ export interface IconGenerateScript {
1111
export interface TemplateProps {
1212
fileName: string;
1313
data: string;
14-
}
14+
}

scripts/iconScript.ts

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,64 @@
1-
import * as path from 'path';
2-
import * as fs from 'fs';
1+
import * as path from 'path'
2+
import * as fs from 'fs'
33

4-
import { IconGenerateScript } from '../interface/index';
5-
import componentTemplate from '../template/iconComponent';
6-
import iconIndexTemplate from '../template/iconIndex';
4+
import { IconGenerateScript } from '../interface/index'
5+
import componentTemplate from '../template/iconComponent'
6+
import iconIndexTemplate from '../template/iconIndex'
77

8-
async function generateIconComponents({type,from}: IconGenerateScript) {
9-
10-
const iconNames = await fs.promises.readdir(from);
11-
for(const iconName of iconNames) {
12-
const fileName = iconName.slice(0, iconName.length - 4).concat(type.charAt(0).toUpperCase() + type.slice(1));
8+
async function generateIconComponents ({ type, from }: IconGenerateScript) {
9+
const iconNames = await fs.promises.readdir(from)
10+
for (const iconName of iconNames) {
11+
const fileName = iconName.slice(0, iconName.length - 4).concat(type.charAt(0).toUpperCase() + type.slice(1))
1312

1413
// fetching Data of the required SVG file
15-
fs.readFile(path.resolve(__dirname,`../svg/${type}/${iconName}`),'utf8', async function (err,data) {
16-
if(err) {
17-
console.error(err);
14+
fs.readFile(path.resolve(__dirname, `../svg/${type}/${iconName}`), 'utf8', async function (err, data) {
15+
if (err) {
16+
console.error(err)
1817
}
1918

20-
if(type === 'animated') {
21-
data = data.replace('xml:space="preserve"','');
22-
if(fileName === 'installingAnimated') {
23-
while(data.includes('class="st0"')) {
24-
data = data.replace('class="st0"','className="st0"');
19+
if (type === 'animated') {
20+
data = data.replace('xml:space="preserve"', '')
21+
if (fileName === 'installingAnimated') {
22+
while (data.includes('class="st0"')) {
23+
data = data.replace('class="st0"', 'className="st0"')
2524
}
2625
}
2726
}
2827

29-
const propString = "svg transform={`rotate(${rotate})`} fill={color} width={size} height={size}"
30-
data = data.replace('svg',propString);
28+
// eslint-disable-next-line no-template-curly-in-string
29+
const propString = 'svg transform={`rotate(${rotate})`} fill={color} width={size} height={size}'
30+
data = data.replace('svg', propString)
3131

32-
const render = componentTemplate({fileName,data});
33-
const indexContent = iconIndexTemplate({fileName});
32+
const render = componentTemplate({ fileName, data })
33+
const indexContent = iconIndexTemplate({ fileName })
3434

3535
// creates a .tsx file at src/icon/ containing a react component
3636
fs.writeFile(
37-
path.resolve(__dirname,`../src/icon/${fileName}.tsx`),
38-
render,
37+
path.resolve(__dirname, `../src/icon/${fileName}.tsx`),
38+
render,
3939
{
4040
flag: 'w+'
4141
},
4242
err => {
43-
if(err) {
43+
if (err) {
4444
console.error(err)
4545
}
46-
})
47-
46+
})
47+
4848
// creates a .tsx index file at src/icon/ containing exports of all the icons
4949
fs.writeFile(
50-
path.resolve(__dirname, `../src/icon/index.tsx`),
50+
path.resolve(__dirname, '../src/icon/index.tsx'),
5151
indexContent,
5252
{
5353
flag: 'a+'
5454
},
5555
err => {
56-
if(err) {
56+
if (err) {
5757
console.error(err)
5858
}
59-
});
59+
})
6060
})
61-
62-
fs.close
6361
}
6462
}
6563

66-
export default generateIconComponents;
64+
export default generateIconComponents

scripts/index.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import generateIconComponents from './iconScript';
1+
import generateIconComponents from './iconScript'
22

33
if (process.argv[2] === '--target=filled') {
4-
generateIconComponents({
5-
type: 'filled',
6-
from: 'svg/filled'
7-
})
4+
generateIconComponents({
5+
type: 'filled',
6+
from: 'svg/filled'
7+
})
88
}
9-
10-
if (process.argv[2] === '--target=animated') {
11-
generateIconComponents({
12-
type: 'animated',
13-
from: 'svg/animated'
14-
})
9+
10+
if (process.argv[2] === '--target=animated') {
11+
generateIconComponents({
12+
type: 'animated',
13+
from: 'svg/animated'
14+
})
15+
}
16+
17+
if (process.argv[2] === '--target=outlined') {
18+
generateIconComponents({
19+
type: 'outlined',
20+
from: 'svg/outlined'
21+
})
1522
}
16-
17-
if (process.argv[2] === '--target=outlined') {
18-
generateIconComponents({
19-
type: 'outlined',
20-
from: 'svg/outlined'
21-
})
22-
}

template/iconComponent.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { TemplateProps } from '../interface/index';
1+
import { TemplateProps } from '../interface/index'
22

3-
function componentTemplate ({fileName,data}:TemplateProps) {
4-
const render = `
3+
function componentTemplate ({ fileName, data }:TemplateProps) {
4+
const render = `
55
// GENERATED BY ./scripts/iconScript.ts
66
77
import * as React from 'react';
@@ -18,8 +18,8 @@ return (
1818
};
1919
2020
export default Eos${fileName};
21-
`;
22-
return (render)
21+
`
22+
return (render)
2323
}
2424

25-
export default componentTemplate;
25+
export default componentTemplate

template/iconIndex.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ interface TemplateProps {
22
fileName: string;
33
}
44

5-
function iconIndexTemplate ({fileName}:TemplateProps) {
6-
const indexContent = `export { default as Eos${fileName} } from './${fileName}';
7-
`;
8-
return (indexContent)
5+
function iconIndexTemplate ({ fileName }:TemplateProps) {
6+
const indexContent = `export { default as Eos${fileName} } from './${fileName}';
7+
`
8+
return (indexContent)
99
}
1010

11-
export default iconIndexTemplate;
11+
export default iconIndexTemplate

template/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
//ignore the error in this file
2-
export * from './icon/index';
1+
// ignore the error in this file
2+
export * from './icon/index'

utils/clean.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import del from 'del';
1+
import del from 'del'
22

33
export const clean = (dirs: string[]) =>
4-
function CleanDirectories() {
5-
return del(dirs);
6-
};
4+
function CleanDirectories () {
5+
return del(dirs)
6+
}

utils/copy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { src, dest } from 'gulp';
2-
import { CopyCreatorOptions } from '../interface';
1+
import { src, dest } from 'gulp'
2+
import { CopyCreatorOptions } from '../interface'
33

44
export const copy = ({ from, toDir }: CopyCreatorOptions) =>
5-
function CopyFiles() {
6-
return src(from).pipe(dest(toDir));
7-
};
5+
function CopyFiles () {
6+
return src(from).pipe(dest(toDir))
7+
}

0 commit comments

Comments
 (0)