Skip to content

Commit

Permalink
[core] Format all ts files (mui#20233)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored and EsoterikStare committed Mar 30, 2020
1 parent 2eff7a9 commit a6edb28
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare module '@material-ui/styles' {
}

{
makeStyles(theme => {
makeStyles((theme) => {
// $ExpectType string
const value = theme.myProperty;

Expand Down
48 changes: 24 additions & 24 deletions packages/material-ui/src/styles/createMixins.spec.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { createMuiTheme, makeStyles } from '@material-ui/core/styles';

{
const theme = createMuiTheme({
mixins: {
toolbar: {
background: '#fff',
minHeight: 36,
'@media (min-width:0px) and (orientation: landscape)': {
minHeight: 24
},
'@media (min-width:600px)': {
minHeight: 48
}
},
}
});

const useStyles = makeStyles(theme => ({
appBarSpacer: theme.mixins.toolbar,
toolbarIcon: {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
padding: '0 8px',
...theme.mixins.toolbar,
const theme = createMuiTheme({
mixins: {
toolbar: {
background: '#fff',
minHeight: 36,
'@media (min-width:0px) and (orientation: landscape)': {
minHeight: 24,
},
'@media (min-width:600px)': {
minHeight: 48,
},
}));
},
},
});

const useStyles = makeStyles((theme) => ({
appBarSpacer: theme.mixins.toolbar,
toolbarIcon: {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
padding: '0 8px',
...theme.mixins.toolbar,
},
}));
}
27 changes: 20 additions & 7 deletions packages/material-ui/test/typescript/colors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import { colors, Color } from '@material-ui/core';

const {
amber, blue, blueGrey,
brown, cyan, deepOrange,
deepPurple, green, grey,
indigo, lightBlue, lightGreen,
lime, orange, pink,
purple, red, teal,
yellow, common
amber,
blue,
blueGrey,
brown,
cyan,
deepOrange,
deepPurple,
green,
grey,
indigo,
lightBlue,
lightGreen,
lime,
orange,
pink,
purple,
red,
teal,
yellow,
common,
} = colors;

const colorList: Color[] = [
Expand Down
14 changes: 7 additions & 7 deletions scripts/generateProptypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ async function generateProptypes(
return GenerateResult.NoComponent;
}

proptypes.body.forEach(component => {
component.types.forEach(prop => {
proptypes.body.forEach((component) => {
component.types.forEach((prop) => {
if (prop.name === 'classes' && prop.jsDoc) {
prop.jsDoc += '\nSee [CSS API](#css) below for more details.';
} else if (prop.name === 'children' && !prop.jsDoc) {
Expand Down Expand Up @@ -100,7 +100,7 @@ async function run() {
[
path.resolve(__dirname, '../packages/material-ui/src'),
path.resolve(__dirname, '../packages/material-ui-lab/src'),
].map(folderPath =>
].map((folderPath) =>
glob('+([A-Z])*/+([A-Z])*.d.ts', {
absolute: true,
cwd: folderPath,
Expand All @@ -111,7 +111,7 @@ async function run() {
const files = _.flatten(allFiles)
// Filter out files where the directory name and filename doesn't match
// Example: Modal/ModalManager.d.ts
.filter(filePath => {
.filter((filePath) => {
const folderName = path.basename(path.dirname(filePath));
const fileName = path.basename(filePath, '.d.ts');

Expand All @@ -120,7 +120,7 @@ async function run() {

const program = ttp.createProgram(files, tsconfig);

const promises = files.map<Promise<GenerateResult>>(async tsFile => {
const promises = files.map<Promise<GenerateResult>>(async (tsFile) => {
const jsFile = tsFile.replace('.d.ts', '.js');

if (!ignoreCache && (await fse.stat(jsFile)).mtimeMs > (await fse.stat(tsFile)).mtimeMs) {
Expand All @@ -140,7 +140,7 @@ async function run() {
}

console.log('--- Summary ---');
const groups = _.groupBy(results, x => x);
const groups = _.groupBy(results, (x) => x);

_.forOwn(groups, (count, key) => {
console.log('%s: %d', GenerateResult[(key as unknown) as GenerateResult], count.length);
Expand All @@ -149,7 +149,7 @@ async function run() {
console.log('Total: %d', results.length);
}

run().catch(error => {
run().catch((error) => {
console.error(error);
process.exit(1);
});
2 changes: 1 addition & 1 deletion scripts/prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function runPrettier(options) {
.filter((notEmpty) => notEmpty);

const files = glob
.sync('**/*.{js,tsx,d.ts}', { ignore: ['**/node_modules/**', ...ignoredFiles] })
.sync('**/*.{js,tsx,ts}', { ignore: ['**/node_modules/**', ...ignoredFiles] })
.filter((f) => !changedFiles || changedFiles.has(f));

if (!files.length) {
Expand Down

0 comments on commit a6edb28

Please sign in to comment.