Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
15 changes: 8 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 @@ -75,6 +75,7 @@ async function generateProptypes(
prop.jsDoc = prop.jsDoc.replace(documentRegExp, '');
return true;
}
console.log(prop);

return undefined;
},
Expand All @@ -100,7 +101,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 +112,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 +121,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 +141,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 +150,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