Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit ea53fb6

Browse files
authored
style(eslint): enable spaced-comment, @typescript-eslint/no-unused-vars (#1261)
* fix "spaced-comment" * fix "@typescript-eslint/no-unused-vars" * fix "no-shadow" * reenable no-shadow * remove unused import
1 parent f717dbc commit ea53fb6

File tree

36 files changed

+106
-125
lines changed

36 files changed

+106
-125
lines changed

build/gulp/plugins/gulp-component-menu-behaviors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ type BehaviorMenuItem = {
2020
}
2121

2222
const getTextFromCommentToken = (commentTokens, tokenTitle): string => {
23-
const token = commentTokens.find(token => token.title === tokenTitle)
24-
return token ? token.description : ''
23+
const resultToken = commentTokens.find(token => token.title === tokenTitle)
24+
return resultToken ? resultToken.description : ''
2525
}
2626

2727
export default () => {

build/gulp/tasks/docs.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ const { paths } = config
2525
const g = require('gulp-load-plugins')()
2626
const { colors, log } = g.util
2727

28-
const handleWatchChange = path => log(`File ${path} was changed, running tasks...`)
29-
const handleWatchUnlink = (group, path) => {
30-
log(`File ${path} was deleted, running tasks...`)
31-
remember.forget(group, path)
28+
const handleWatchChange = changedPath => log(`File ${changedPath} was changed, running tasks...`)
29+
const handleWatchUnlink = (group, changedPath) => {
30+
log(`File ${changedPath} was deleted, running tasks...`)
31+
remember.forget(group, changedPath)
3232
}
3333

3434
// ----------------------------------------
@@ -227,7 +227,7 @@ task('watch:docs', cb => {
227227
// rebuild example menus
228228
watch(examplesIndexSrc, series('build:docs:example-menu'))
229229
.on('change', handleWatchChange)
230-
.on('unlink', path => handleWatchUnlink('example-menu', path))
230+
.on('unlink', changedPath => handleWatchUnlink('example-menu', changedPath))
231231

232232
watch(examplesSrc, series('build:docs:example-sources'))
233233
.on('change', handleWatchChange)
@@ -244,7 +244,7 @@ task('watch:docs', cb => {
244244

245245
watch(behaviorSrc, series('build:docs:component-menu-behaviors'))
246246
.on('change', handleWatchChange)
247-
.on('unlink', path => handleWatchUnlink('component-menu-behaviors', path))
247+
.on('unlink', changedPath => handleWatchUnlink('component-menu-behaviors', changedPath))
248248

249249
// rebuild images
250250
watch(`${config.paths.docsSrc()}/**/*.{png,jpg,gif}`, series('build:docs:images')).on(

build/gulp/tasks/perf.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ const normalizeMeasures = (measures: ProfilerMeasureCycle[]): NormalizedMeasures
7272
{},
7373
)
7474

75-
return _.mapValues(perExampleMeasures, (measures: ProfilerMeasure[]) => ({
76-
actualTime: reduceMeasures(measures, 'actualTime'),
77-
baseTime: reduceMeasures(measures, 'baseTime'),
75+
return _.mapValues(perExampleMeasures, (profilerMeasures: ProfilerMeasure[]) => ({
76+
actualTime: reduceMeasures(profilerMeasures, 'actualTime'),
77+
baseTime: reduceMeasures(profilerMeasures, 'baseTime'),
7878
}))
7979
}
8080

build/gulp/tasks/stats.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ const semverCmp = (a, b) => {
4646
return 0
4747
}
4848

49-
function webpackAsync(config): Promise<any> {
49+
function webpackAsync(webpackConfig): Promise<any> {
5050
return new Promise((resolve, reject) => {
51-
const compiler = webpack(config)
51+
const compiler = webpack(webpackConfig)
5252
compiler.run((err, stats) => {
5353
const statsJson = stats.toJson()
5454
const { errors, warnings } = statsJson
@@ -73,14 +73,14 @@ function webpackAsync(config): Promise<any> {
7373

7474
async function compileOneByOne(allConfigs) {
7575
let assets = []
76-
for (const config of allConfigs) {
77-
log('Compiling', config.output.filename)
76+
for (const webpackConfig of allConfigs) {
77+
log('Compiling', webpackConfig.output.filename)
7878
try {
79-
const result = await webpackAsync(config)
79+
const result = await webpackAsync(webpackConfig)
8080
assets = [...assets, ...result.assets]
8181
log('Done', result.assets[0].name) // All builds should produce just single asset
8282
} catch (err) {
83-
log('Error', config.output.filename)
83+
log('Error', webpackConfig.output.filename)
8484
throw err
8585
}
8686
}

build/gulp/tasks/test-projects.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const log = (context: string) => (message: string) => {
2323
console.log('='.repeat(80))
2424
}
2525

26-
export const runIn = path => cmd => sh(`cd ${path} && ${cmd}`)
26+
export const runIn = targetPath => cmd => sh(`cd ${targetPath} && ${cmd}`)
2727

2828
const addResolutionPathsForStardustPackages = async (
2929
testProjectDir: string,
@@ -136,7 +136,6 @@ task('test:projects:cra-ts', async () => {
136136
const logger = log('test:projects:cra-ts')
137137
const scaffoldPath = paths.base.bind(null, 'build/gulp/tasks/test-projects/cra')
138138

139-
//////// CREATE TEST REACT APP ///////
140139
logger('STEP 1. Create test React project with TSX scripts..')
141140

142141
const testAppPath = paths.withRootAt(
@@ -146,19 +145,16 @@ task('test:projects:cra-ts', async () => {
146145
const runInTestApp = runIn(testAppPath())
147146
logger(`Test React project is successfully created: ${testAppPath()}`)
148147

149-
//////// ADD STARDUST AS A DEPENDENCY ///////
150148
logger('STEP 2. Add Stardust dependency to test project..')
151149

152150
const packedPackages = await packStardustPackages(logger)
153151
await addResolutionPathsForStardustPackages(testAppPath(), packedPackages)
154152
await runInTestApp(`yarn add ${packedPackages['@stardust-ui/react']}`)
155153
logger(`✔️Stardust UI packages were added to dependencies`)
156154

157-
//////// REFERENCE STARDUST COMPONENTS IN TEST APP's MAIN FILE ///////
158155
logger("STEP 3. Reference Stardust components in test project's App.tsx")
159156
fs.copyFileSync(scaffoldPath('App.tsx'), testAppPath('src', 'App.tsx'))
160157

161-
//////// BUILD TEST PROJECT ///////
162158
logger('STEP 4. Build test project..')
163159
await runInTestApp(`yarn build`)
164160

build/gulp/tasks/test-vulns.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ const SCAN_RESULTS_DIR_PATH = paths.base(SCAN_RESULTS_DIR_NAME)
1414
const log = message => debug.log(message)
1515
log.success = message => debug.log(`✔ ${message}`)
1616

17-
const ensureDirExists = path => {
18-
if (!fs.existsSync(path)) {
19-
sh(`mkdir -p ${path}`)
17+
const ensureDirExists = directoryPath => {
18+
if (!fs.existsSync(directoryPath)) {
19+
sh(`mkdir -p ${directoryPath}`)
2020
}
2121
}
2222

docs/src/app.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react'
2-
import * as _ from 'lodash'
32
import { Provider, themes } from '@stardust-ui/react'
43

54
import { mergeThemes } from 'src/lib'

docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsRow.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ export default class ComponentPropsRow extends React.Component<any, any> {
4343
<td>
4444
<ComponentPropDescription description={description} />
4545
{/* TODO change these according to the react-docgen-typescript generated json */}
46-
{/*<ComponentPropFunctionSignature name={name} tags={tags} />*/}
47-
{/*<ComponentPropEnum*/}
48-
{/*showAll={showEnums}*/}
49-
{/*toggle={this.toggleEnums}*/}
50-
{/*type={type}*/}
51-
{/*values={value}*/}
52-
{/*/>*/}
46+
{/* <ComponentPropFunctionSignature name={name} tags={tags} /> */}
47+
{/* <ComponentPropEnum */}
48+
{/* showAll={showEnums} */}
49+
{/* toggle={this.toggleEnums} */}
50+
{/* type={type} */}
51+
{/* values={value} */}
52+
{/* /> */}
5353
</td>
5454
</tr>
5555
)

docs/src/components/ComponentDoc/PerfChart/PerfDataProvider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const PerfDataProvider: React.FC = ({ children }) => {
2727
setData(responseJson)
2828
setLoading(false)
2929
})
30-
.catch(error => {
31-
setError(error)
30+
.catch(e => {
31+
setError(e)
3232
setLoading(false)
3333
})
3434
}

docs/src/components/ComponentPlayground.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ type ComponentPlaygroundProps = {
1313
}
1414

1515
const ComponentPlayground: React.FunctionComponent<ComponentPlaygroundProps> = props => {
16-
const playgroundPath = _.find(playgroundPaths, playgroundPath =>
16+
const resultPath = _.find(playgroundPaths, playgroundPath =>
1717
_.includes(playgroundPath, `/${props.componentName}/`),
1818
)
1919

20-
if (playgroundPath) {
21-
const PlaygroundComponent: React.FunctionComponent = examplePlaygroundContext(playgroundPath)
20+
if (resultPath) {
21+
const PlaygroundComponent: React.FunctionComponent = examplePlaygroundContext(resultPath)
2222
.default
2323

2424
return (

0 commit comments

Comments
 (0)