Skip to content

Commit

Permalink
Fix stylelint config
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky committed May 12, 2017
1 parent 4522aa7 commit 8d8b494
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,19 @@ prompt(
const folders = ['config', 'config/jest', 'scripts', 'scripts/utils'];

// Make shallow array of files paths
const files = folders.reduce((files, folder) => {
return files.concat(
fs
.readdirSync(path.join(ownPath, folder))
// set full path
.map(file => path.join(ownPath, folder, file))
// omit dirs from file list
.filter(file => fs.lstatSync(file).isFile())
);
}, []);
const files = folders.reduce(
(files, folder) => {
return files.concat(
fs
.readdirSync(path.join(ownPath, folder))
// set full path
.map(file => path.join(ownPath, folder, file))
// omit dirs from file list
.filter(file => fs.lstatSync(file).isFile())
);
},
[]
);

// Ensure that the app folder is clean and we won't override any files
folders.forEach(verifyAbsent);
Expand All @@ -85,19 +88,18 @@ prompt(
if (content.match(/\/\/ @remove-file-on-eject/)) {
return;
}
content =
content
// Remove dead code from .js files on eject
.replace(
/\/\/ @remove-on-eject-begin([\s\S]*?)\/\/ @remove-on-eject-end/gm,
''
)
// Remove dead code from .applescript files on eject
.replace(
/-- @remove-on-eject-begin([\s\S]*?)-- @remove-on-eject-end/gm,
''
)
.trim() + '\n';
content = content
// Remove dead code from .js files on eject
.replace(
/\/\/ @remove-on-eject-begin([\s\S]*?)\/\/ @remove-on-eject-end/gm,
''
)
// Remove dead code from .applescript files on eject
.replace(
/-- @remove-on-eject-begin([\s\S]*?)-- @remove-on-eject-end/gm,
''
)
.trim() + '\n';
console.log(` Adding ${cyan(file.replace(ownPath, ''))} to the project`);
fs.writeFileSync(file.replace(ownPath, appPath), content);
});
Expand Down Expand Up @@ -166,7 +168,7 @@ prompt(
// Add stylelint config
console.log(` Adding ${cyan('stylelint')} configuration`);
appPackage.stylelint = {
extends: 'stylelint-config-standard',
extends: 'stylelint-config-react-app',
};

fs.writeFileSync(
Expand Down

0 comments on commit 8d8b494

Please sign in to comment.