This repository has been archived by the owner on Mar 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Migrate tc-web to neutrino v9 #157
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
777d286
WIP Migrate tc-web to neutrino v9
helfi92 61e0b9b
More changes
helfi92 5b78027
Add requested changes
helfi92 07c527f
Nits
helfi92 2775e83
Use material's new typograpghy v2 variants
helfi92 a546405
Fix linting errors
helfi92 48d735d
Add required changes after rebasing
helfi92 079d3c8
Regenerate yarn.lock with node 10
helfi92 bf98c37
Nits after rebasing on master
helfi92 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
const { Neutrino } = require('neutrino'); | ||
const neutrino = require('neutrino'); | ||
|
||
module.exports = Neutrino({ root: __dirname }) | ||
.use('.neutrinorc') | ||
.call('eslintrc'); | ||
module.exports = neutrino().eslintrc(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ node_modules | |
/styleguide | ||
.coverage | ||
.DS_Store | ||
.eslintcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,67 @@ | ||
const { join } = require('path'); | ||
const merge = require('deepmerge'); | ||
|
||
require('babel-register')({ | ||
plugins: [ | ||
[require.resolve('babel-plugin-transform-es2015-modules-commonjs'), { | ||
useBuiltIns: true | ||
}], | ||
require.resolve('babel-plugin-transform-object-rest-spread'), | ||
], | ||
cache: false, | ||
}); | ||
|
||
const theme = require('./src/theme').default; | ||
|
||
module.exports = { | ||
use: [ | ||
['neutrino-preset-mozilla-frontend-infra/styleguide', { | ||
components: 'src/components/**/index.jsx', | ||
theme: theme.styleguide, | ||
styles: { | ||
StyleGuide: theme.styleguide.StyleGuide, | ||
}, | ||
editorConfig: { | ||
theme: 'material', | ||
}, | ||
showUsage: true, | ||
skipComponentsWithoutExample: false, | ||
styleguideComponents: { | ||
Wrapper: join(__dirname, 'src/styleguide/ThemeWrapper.jsx'), | ||
StyleGuideRenderer: join(__dirname, 'src/styleguide/StyleGuideRenderer.jsx'), | ||
['@neutrinojs/airbnb', { | ||
eslint: { | ||
parserOptions: { | ||
ecmaFeatures: { | ||
legacyDecorators: true | ||
} | ||
}, | ||
emitWarning: process.env.NODE_ENV === 'development', | ||
baseConfig: { | ||
extends: ['plugin:react/recommended', 'eslint-config-prettier'], | ||
}, | ||
envs: ['worker', 'serviceworker'], | ||
plugins: ['prettier'], | ||
rules: { | ||
'react/jsx-wrap-multilines': 'off', | ||
'react/prop-types': 'off', | ||
'react/jsx-one-expression-per-line': 'off', | ||
'react/forbid-prop-types': 'off', | ||
'react/prefer-stateless-function': 'off', | ||
'react/no-access-state-in-setstate': 'off', | ||
'react/destructuring-assignment': 'off', | ||
'babel/no-unused-expressions': 'off', | ||
'import/no-extraneous-dependencies': 'off', | ||
// Specify the maximum length of a line in your program | ||
'max-len': [ | ||
'error', | ||
80, | ||
2, | ||
{ | ||
ignoreUrls: true, | ||
ignoreComments: false, | ||
ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
}, | ||
], | ||
// Allow using class methods with static/non-instance functionality | ||
// React lifecycle methods commonly do not use an instance context for | ||
// anything | ||
'class-methods-use-this': 'off', | ||
// Allow console during development, otherwise throw an error | ||
'no-console': process.env.NODE_ENV === 'development' ? 'off' : 'error', | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
singleQuote: true, | ||
trailingComma: 'es5', | ||
bracketSpacing: true, | ||
jsxBracketSameLine: false, | ||
}, | ||
], | ||
'consistent-return': 'off', | ||
'no-shadow': 'off', | ||
'no-return-assign': 'off', | ||
'babel/new-cap': 'off', | ||
'no-mixed-operators': 'off', | ||
}, | ||
}, | ||
}], | ||
['neutrino-preset-mozilla-frontend-infra/react', { | ||
['@neutrinojs/react', { | ||
publicPath: '/', | ||
html: { | ||
title: process.env.APPLICATION_NAME | ||
}, | ||
|
@@ -52,26 +82,21 @@ module.exports = { | |
}, | ||
}, | ||
}, | ||
eslint: { | ||
rules: { | ||
// This has been set in the latest Airbnb preset, but has not been | ||
// released yet. | ||
'react/no-did-mount-set-state': 'off', | ||
} | ||
} | ||
env: [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it helps, this |
||
'APPLICATION_NAME', | ||
'LOGIN_STRATEGIES', | ||
'PORT', | ||
'TASKCLUSTER_ROOT_URL', | ||
'GRAPHQL_SUBSCRIPTION_ENDPOINT', | ||
], | ||
babel: { | ||
plugins: [ | ||
[require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }], | ||
require.resolve('@babel/plugin-proposal-class-properties'), | ||
], | ||
}, | ||
}], | ||
['@neutrinojs/env', [ | ||
'NODE_ENV', | ||
'APPLICATION_NAME', | ||
'LOGIN_STRATEGIES', | ||
'TASKCLUSTER_ROOT_URL', | ||
'GRAPHQL_SUBSCRIPTION_ENDPOINT', | ||
]], | ||
(neutrino) => { | ||
if (process.env.NODE_ENV === 'development') { | ||
neutrino.config.devtool('cheap-module-source-map'); | ||
} | ||
|
||
neutrino.config.node.set('Buffer', true); | ||
|
||
// The shell view requires this | ||
|
@@ -80,7 +105,6 @@ module.exports = { | |
bindings: 'bindings' | ||
})); | ||
|
||
neutrino.config.output.publicPath('/'); | ||
neutrino.config.module | ||
.rule('graphql') | ||
.test(/\.graphql$/) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const neutrino = require('neutrino'); | ||
|
||
process.env.NODE_ENV = process.env.NODE_ENV || 'test'; | ||
|
||
module.exports = neutrino().karma(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll likely be making this change upstream soon, see:
neutrinojs/neutrino#1131 (comment)