mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-11 20:21:10 +00:00
Opt-in root javascript files to Prettier
This commit is contained in:
parent
e8270e2807
commit
4ee7e34f6e
|
@ -83,4 +83,4 @@ app/javascript/styles/mastodon/reset.scss
|
||||||
AUTHORS.md
|
AUTHORS.md
|
||||||
|
|
||||||
# Process a few selected JS files
|
# Process a few selected JS files
|
||||||
!lint-staged.config.js
|
!/*.js
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
singleQuote: true,
|
singleQuote: true,
|
||||||
jsxSingleQuote: true
|
jsxSingleQuote: true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,8 +7,8 @@ module.exports = (api) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const envOptions = {
|
const envOptions = {
|
||||||
useBuiltIns: "usage",
|
useBuiltIns: 'usage',
|
||||||
corejs: { version: "3.30" },
|
corejs: { version: '3.30' },
|
||||||
debug: false,
|
debug: false,
|
||||||
include: [
|
include: [
|
||||||
'transform-numeric-separator',
|
'transform-numeric-separator',
|
||||||
|
@ -18,45 +18,42 @@ module.exports = (api) => {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [['formatjs'], 'preval'];
|
||||||
['formatjs'],
|
|
||||||
'preval',
|
|
||||||
];
|
|
||||||
|
|
||||||
switch (env) {
|
switch (env) {
|
||||||
case 'production':
|
case 'production':
|
||||||
plugins.push(...[
|
plugins.push(
|
||||||
'lodash',
|
...[
|
||||||
[
|
'lodash',
|
||||||
'transform-react-remove-prop-types',
|
[
|
||||||
{
|
'transform-react-remove-prop-types',
|
||||||
mode: 'remove',
|
{
|
||||||
removeImport: true,
|
mode: 'remove',
|
||||||
additionalLibraries: [
|
removeImport: true,
|
||||||
'react-immutable-proptypes',
|
additionalLibraries: ['react-immutable-proptypes'],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
'@babel/transform-react-inline-elements',
|
||||||
],
|
[
|
||||||
'@babel/transform-react-inline-elements',
|
'@babel/transform-runtime',
|
||||||
[
|
{
|
||||||
'@babel/transform-runtime',
|
helpers: true,
|
||||||
{
|
regenerator: false,
|
||||||
helpers: true,
|
useESModules: true,
|
||||||
regenerator: false,
|
},
|
||||||
useESModules: true,
|
],
|
||||||
},
|
],
|
||||||
],
|
);
|
||||||
]);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case 'development':
|
case 'development':
|
||||||
reactOptions.development = true;
|
reactOptions.development = true;
|
||||||
envOptions.debug = true;
|
envOptions.debug = true;
|
||||||
|
|
||||||
// We need Babel to not inject polyfills in dev, as this breaks `preval` files
|
// We need Babel to not inject polyfills in dev, as this breaks `preval` files
|
||||||
envOptions.useBuiltIns = false;
|
envOptions.useBuiltIns = false;
|
||||||
envOptions.corejs = undefined;
|
envOptions.corejs = undefined;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
|
@ -69,9 +66,7 @@ module.exports = (api) => {
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
test: [/tesseract\.js/, /fuzzysort\.js/],
|
test: [/tesseract\.js/, /fuzzysort\.js/],
|
||||||
presets: [
|
presets: [['@babel/env', { ...envOptions, modules: 'commonjs' }]],
|
||||||
['@babel/env', { ...envOptions, modules: 'commonjs' }],
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@ jetbrains://WebStorm/settings?name=Languages+%26+Frameworks--JavaScript--Webpack
|
||||||
module.exports = {
|
module.exports = {
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'mastodon': path.resolve(__dirname, 'app/javascript/mastodon'),
|
mastodon: path.resolve(__dirname, 'app/javascript/mastodon'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,8 +5,8 @@ const config = ({ env }) => ({
|
||||||
plugins: [
|
plugins: [
|
||||||
postcssPresetEnv({
|
postcssPresetEnv({
|
||||||
features: {
|
features: {
|
||||||
'logical-properties-and-values': false
|
'logical-properties-and-values': false,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
env === 'production' ? require('cssnano') : '',
|
env === 'production' ? require('cssnano') : '',
|
||||||
],
|
],
|
||||||
|
|
|
@ -31,14 +31,13 @@ module.exports = {
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
'files': ['app/javascript/styles/mailer.scss'],
|
files: ['app/javascript/styles/mailer.scss'],
|
||||||
rules: {
|
rules: {
|
||||||
'property-no-unknown': [
|
'property-no-unknown': [
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
ignoreProperties: [
|
ignoreProperties: ['/^mso-/'],
|
||||||
'/^mso-/',
|
},
|
||||||
] },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user