Skip to content

Commit

Permalink
fixes tests and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-johnson committed Dec 1, 2018
1 parent c0f3197 commit 582d3bc
Show file tree
Hide file tree
Showing 26 changed files with 72 additions and 43,125 deletions.
11,076 changes: 0 additions & 11,076 deletions minimal_redux_poc/package-lock.json

This file was deleted.

2 changes: 2 additions & 0 deletions packages/mirador3-app/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"page": true,
"document": true
},
"parser": "babel-eslint",
"plugins": ["jest"],
"rules": {
"global-require": "off",
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"require-jsdoc": ["error", {
"require": {
Expand Down
4 changes: 1 addition & 3 deletions packages/mirador3-app/config/env.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const fs = require('fs');
const path = require('path');
const paths = require('./paths');
Expand Down Expand Up @@ -30,7 +28,7 @@ var dotenvFiles = [
// that have already been set. Variable expansion is supported in .env files.
// https://github.com/motdotla/dotenv
// https://github.com/motdotla/dotenv-expand
dotenvFiles.forEach(dotenvFile => {
dotenvFiles.forEach((dotenvFile) => {
if (fs.existsSync(dotenvFile)) {
require('dotenv-expand')(
require('dotenv').config({
Expand Down
2 changes: 0 additions & 2 deletions packages/mirador3-app/config/jest/cssTransform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/en/webpack.html

Expand Down
2 changes: 0 additions & 2 deletions packages/mirador3-app/config/jest/fileTransform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const path = require('path');

// This is a custom Jest transformer turning file imports into filenames.
Expand Down
11 changes: 2 additions & 9 deletions packages/mirador3-app/config/paths.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const path = require('path');
const fs = require('fs');
const url = require('url');
Expand All @@ -22,8 +20,7 @@ function ensureSlash(inputPath, needsSlash) {
}
}

const getPublicUrl = appPackageJson =>
envPublicUrl || require(appPackageJson).homepage;
const getPublicUrl = appPackageJson => envPublicUrl || require(appPackageJson).homepage;

// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
Expand Down Expand Up @@ -54,9 +51,7 @@ const moduleFileExtensions = [

// Resolve file paths in the same order as webpack
const resolveModule = (resolveFn, filePath) => {
const extension = moduleFileExtensions.find(extension =>
fs.existsSync(resolveFn(`${filePath}.${extension}`))
);
const extension = moduleFileExtensions.find(extension => fs.existsSync(resolveFn(`${filePath}.${extension}`)));

if (extension) {
return resolveFn(`${filePath}.${extension}`);
Expand Down Expand Up @@ -84,6 +79,4 @@ module.exports = {
servedPath: getServedPath(resolveApp('package.json')),
};



module.exports.moduleFileExtensions = moduleFileExtensions;
18 changes: 6 additions & 12 deletions packages/mirador3-app/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const fs = require('fs');
const path = require('path');
const resolve = require('resolve');
Expand Down Expand Up @@ -111,10 +109,9 @@ module.exports = {
// There are also additional JS chunk files if you use code splitting.
chunkFilename: 'static/js/[name].chunk.js',
// This is the URL that app is served from. We use "/" in development.
publicPath: publicPath,
publicPath,
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: info =>
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'),
devtoolModuleFilenameTemplate: info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'),
},
optimization: {
// Automatically split vendor and commons
Expand All @@ -135,7 +132,7 @@ module.exports = {
// https://github.com/facebook/create-react-app/issues/253
modules: ['node_modules'].concat(
// It is guaranteed to exist because we tweak it in `env.js`
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
process.env.NODE_PATH.split(path.delimiter).filter(Boolean),
),
// These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support
Expand Down Expand Up @@ -186,7 +183,6 @@ module.exports = {
options: {
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),

},
loader: require.resolve('eslint-loader'),
},
Expand Down Expand Up @@ -217,9 +213,8 @@ module.exports = {
loader: require.resolve('babel-loader'),
options: {
customize: require.resolve(
'babel-preset-react-app/webpack-overrides'
'babel-preset-react-app/webpack-overrides',
),

plugins: [
[
require.resolve('babel-plugin-named-asset-import'),
Expand Down Expand Up @@ -259,7 +254,6 @@ module.exports = {
cacheDirectory: true,
// Don't waste time on Gzipping the cache
cacheCompression: false,

// If an error happens in a package, it's possible to be
// because it was compiled. Thus, we don't want the browser
// debugger to show the original code. Instead, the code
Expand Down Expand Up @@ -310,7 +304,7 @@ module.exports = {
modules: true,
getLocalIdent: getCSSModuleLocalIdent,
},
'sass-loader'
'sass-loader',
),
},
// "file" loader makes sure those assets get served by WebpackDevServer.
Expand Down Expand Up @@ -374,7 +368,7 @@ module.exports = {
// having to parse `index.html`.
new ManifestPlugin({
fileName: 'asset-manifest.json',
publicPath: publicPath,
publicPath,
}),
// TypeScript type checking
useTypeScript &&
Expand Down
34 changes: 14 additions & 20 deletions packages/mirador3-app/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
Expand Down Expand Up @@ -124,12 +122,11 @@ module.exports = {
filename: 'static/js/[name].[chunkhash:8].js',
chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath: publicPath,
publicPath,
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: info =>
path
.relative(paths.appSrc, info.absoluteResourcePath)
.replace(/\\/g, '/'),
devtoolModuleFilenameTemplate: info => path
.relative(paths.appSrc, info.absoluteResourcePath)
.replace(/\\/g, '/'),
},
optimization: {
minimizer: [
Expand Down Expand Up @@ -180,13 +177,13 @@ module.exports = {
parser: safePostCssParser,
map: shouldUseSourceMap
? {
// `inline: false` forces the sourcemap to be output into a
// separate file
inline: false,
// `annotation: true` appends the sourceMappingURL to the end of
// the css file, helping the browser find the sourcemap
annotation: true,
}
// `inline: false` forces the sourcemap to be output into a
// separate file
inline: false,
// `annotation: true` appends the sourceMappingURL to the end of
// the css file, helping the browser find the sourcemap
annotation: true,
}
: false,
},
}),
Expand Down Expand Up @@ -260,7 +257,6 @@ module.exports = {
options: {
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),

},
loader: require.resolve('eslint-loader'),
},
Expand Down Expand Up @@ -291,9 +287,8 @@ module.exports = {
loader: require.resolve('babel-loader'),
options: {
customize: require.resolve(
'babel-preset-react-app/webpack-overrides'
'babel-preset-react-app/webpack-overrides',
),

plugins: [
[
require.resolve('babel-plugin-named-asset-import'),
Expand Down Expand Up @@ -331,7 +326,6 @@ module.exports = {
cacheDirectory: true,
// Save disk space when time isn't as important
cacheCompression: true,

// If an error happens in a package, it's possible to be
// because it was compiled. Thus, we don't want the browser
// debugger to show the original code. Instead, the code
Expand Down Expand Up @@ -381,7 +375,7 @@ module.exports = {
importLoaders: 2,
sourceMap: shouldUseSourceMap,
},
'sass-loader'
'sass-loader',
),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
Expand Down Expand Up @@ -471,7 +465,7 @@ module.exports = {
// having to parse `index.html`.
new ManifestPlugin({
fileName: 'asset-manifest.json',
publicPath: publicPath,
publicPath,
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
Expand Down
2 changes: 0 additions & 2 deletions packages/mirador3-app/config/webpackDevServer.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
Expand Down
Loading

0 comments on commit 582d3bc

Please sign in to comment.