Skip to content

Commit 2fcc872

Browse files
author
Simon Taggart
authored
fix: run eslint across the right files and fix any issues that arise. (#21)
* fix: run eslint on all files and fix errors * fix: adjust for generated build assets * fix: typos * fix: just ignore all definition files
1 parent e7f2432 commit 2fcc872

File tree

13 files changed

+46
-29
lines changed

13 files changed

+46
-29
lines changed

.eslintignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
/bower_components/**
33
/packages/**/node_modules/**
44
**/lib/**
5-
rollup.config.js
5+
**/dist/**
6+
**/paste-icons/react/
7+
rollup.config.js
8+
**/tsconfig.build.tsbuildinfo
9+
**/*.d.ts

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ module.exports = {
5151
// with babel compiled typescript.
5252
'@typescript-eslint/no-var-requires': 'off',
5353
// Enforce template strings for styles over objects for consistent codebase
54-
'emotion/syntax-preference': [2, 'string'],
54+
// We can switch this to object at anytime, but lowering to warn as we have a mixed condebase right now.
55+
'emotion/syntax-preference': [1, 'string'],
5556
// PropTypes are useless with typescript
5657
'react/prop-types': 'off',
5758
// Avoid having to redefine story deps for this monorepo

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"test:coverage": "yarn pre-test && node --experimental-worker ./node_modules/.bin/jest --coverage",
3434
"prettier": "prettier --list-different '{.storybook,packages}/**/*.{ts,tsx}'",
3535
"prettier-clean": "prettier --write '{.storybook,packages}/**/*.{ts,tsx}'",
36-
"lint": "eslint ./packages/**/*.ts ./packages/**/*.tsx ",
36+
"lint": "eslint --ext .tsx,.ts ./packages/**",
3737
"type-check": "lerna run type-check"
3838
},
3939
"dependencies": {

packages/paste-core/components/button/src/styles.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ import {ButtonWrapperProps, ButtonChildrenProps} from './types';
1111
const sizeReset = css`
1212
padding: 0;
1313
`;
14-
const sizeIcon = (props: ButtonWrapperProps) => css`
14+
const sizeIcon = (props: ButtonWrapperProps): SerializedStyles => css`
1515
padding: ${themeGet('space.space30')(props)};
1616
border-radius: ${themeGet('radii.borderRadius20')(props)};
1717
/* To fix abnormal button padding-bottom */
1818
line-height: unset;
1919
`;
20-
const sizeSmall = (props: ButtonWrapperProps) => css`
20+
const sizeSmall = (props: ButtonWrapperProps): SerializedStyles => css`
2121
padding: ${themeGet('space.space10')(props)} ${themeGet('space.space30')(props)};
2222
border-radius: ${themeGet('radii.borderRadius10')(props)};
2323
font-size: ${themeGet('fontSizes.fontSize20')(props)};
2424
line-height: 24px;
2525
`;
26-
const sizeDefault = (props: ButtonWrapperProps) => css`
26+
const sizeDefault = (props: ButtonWrapperProps): SerializedStyles => css`
2727
padding: ${themeGet('space.space30')(props)} ${themeGet('space.space60')(props)};
2828
border-radius: ${themeGet('radii.borderRadius20')(props)};
2929
font-size: ${themeGet('fontSizes.fontSize20')(props)};
@@ -79,7 +79,7 @@ const baseDisabled = css([
7979
* Variants
8080
*/
8181
// Primary
82-
const variantPrimaryBase = (props: ButtonWrapperProps) => css`
82+
const variantPrimaryBase = (props: ButtonWrapperProps): SerializedStyles => css`
8383
border-width: ${themeGet('borderWidths.borderWidth10')(props)};
8484
border-style: solid;
8585
color: ${themeGet('textColors.colorTextInverse')(props)};
@@ -134,7 +134,7 @@ const variantPrimaryDisabled = (props: ButtonWrapperProps): SerializedStyles =>
134134
]);
135135

136136
// Secondary
137-
const variantSecondaryBase = (props: ButtonWrapperProps) => css`
137+
const variantSecondaryBase = (props: ButtonWrapperProps): SerializedStyles => css`
138138
border-width: ${themeGet('borderWidths.borderWidth10')(props)};
139139
border-style: solid;
140140
background-color: ${themeGet('backgroundColors.colorBackgroundBody')(props)};
@@ -182,7 +182,7 @@ const variantSecondaryDisabled = (props: ButtonWrapperProps): SerializedStyles =
182182
]);
183183

184184
// Destructive
185-
const variantDestructiveBase = (props: ButtonWrapperProps) => css`
185+
const variantDestructiveBase = (props: ButtonWrapperProps): SerializedStyles => css`
186186
border-width: ${themeGet('borderWidths.borderWidth10')(props)};
187187
border-style: solid;
188188
background-color: ${themeGet('backgroundColors.colorBackgroundBody')(props)};

packages/paste-core/components/spinner/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface SpinnerProps extends SpinnerIconProps {
2626
title: string;
2727
}
2828

29-
const Spinner = (props: SpinnerProps) => (
29+
const Spinner: React.FC<SpinnerProps> = props => (
3030
<SpinningWrapper>
3131
<SpinnerIcon {...props} />
3232
</SpinningWrapper>

packages/paste-design-tokens/formatters/common.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as lodash from 'lodash';
22
import {ImmutableStyleMap} from 'theo';
33
import {Token} from '../types';
4-
import getTokenCategories from '../utils/getTokenCategories';
5-
import formatSingleTokensWithTemplate from '../utils/formatSingleTokensWithTemplate';
6-
import formatGroupTokensWithTemplate from '../utils/formatGroupTokensWithTemplate';
4+
import {getTokenCategories} from '../utils/getTokenCategories';
5+
import {formatSingleTokensWithTemplate} from '../utils/formatSingleTokensWithTemplate';
6+
import {formatGroupTokensWithTemplate} from '../utils/formatGroupTokensWithTemplate';
77

88
export const tokenTemplate = ({name, value}: {name: string; value: string}): string =>
99
`const ${lodash.camelCase(name)} = "${value.replace(/"/g, '\\"')}";`;

packages/paste-design-tokens/formatters/d.ts.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as lodash from 'lodash';
22
import {ImmutableStyleMap} from 'theo';
33
import {Token} from '../types';
4-
import getTokenCategories from '../utils/getTokenCategories';
5-
import formatSingleTokensWithTemplate from '../utils/formatSingleTokensWithTemplate';
6-
import formatGroupTokensWithTemplate from '../utils/formatGroupTokensWithTemplate';
4+
import {getTokenCategories} from '../utils/getTokenCategories';
5+
import {formatSingleTokensWithTemplate} from '../utils/formatSingleTokensWithTemplate';
6+
import {formatGroupTokensWithTemplate} from '../utils/formatGroupTokensWithTemplate';
77

88
export const tokenTemplate = ({name, value}: {name: string; value: string}): string =>
99
`export declare const ${lodash.camelCase(name)} = "${value}";`;

packages/paste-design-tokens/formatters/es6.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as lodash from 'lodash';
22
import {ImmutableStyleMap} from 'theo';
33
import {Token} from '../types';
4-
import getTokenCategories from '../utils/getTokenCategories';
5-
import formatSingleTokensWithTemplate from '../utils/formatSingleTokensWithTemplate';
6-
import formatGroupTokensWithTemplate from '../utils/formatGroupTokensWithTemplate';
4+
import {getTokenCategories} from '../utils/getTokenCategories';
5+
import {formatSingleTokensWithTemplate} from '../utils/formatSingleTokensWithTemplate';
6+
import {formatGroupTokensWithTemplate} from '../utils/formatGroupTokensWithTemplate';
77

88
export const tokenTemplate = ({name, value}: {name: string; value: string}): string =>
99
`export const ${lodash.camelCase(name)} = "${value.replace(/"/g, '\\"')}";`;

packages/paste-design-tokens/formatters/gatsby.json.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {ImmutableStyleMap} from 'theo';
22
import {Token} from '../types';
3-
import getTokenCategories from '../utils/getTokenCategories';
4-
import formatGroupTokensWithTemplate from '../utils/formatGroupTokensWithTemplate';
3+
import {getTokenCategories} from '../utils/getTokenCategories';
4+
import {formatGroupTokensWithTemplate} from '../utils/formatGroupTokensWithTemplate';
55

66
export const categoryTemplate = (categoryName: string, props: Token[]): string => {
77
return `{

packages/paste-design-tokens/utils/formatGroupTokensWithTemplate/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ const getPluralCatName = (name: string): string => {
4444
return pluralName;
4545
};
4646

47-
export default (
47+
export const formatGroupTokensWithTemplate = (
4848
tokens: ImmutableStyleMap,
4949
categories: any,
50-
categoryTemplate: (cat: string, props: Token[]) => void
50+
categoryTemplate: (cat: string, props: Token[]) => string
5151
): string => {
5252
return categories
53-
.map((cat: string) => {
53+
.map((cat: string): string | undefined => {
5454
const catProps = tokens
5555
.get('props')
5656
.sortBy(prop => {
@@ -64,6 +64,7 @@ export default (
6464
if (typeof cat === 'string') {
6565
return categoryTemplate(getPluralCatName(cat), catProps);
6666
}
67+
return undefined;
6768
})
6869
.join('\n');
6970
};

0 commit comments

Comments
 (0)