Skip to content

Commit

Permalink
Feature/fix vue example e2e failing (#895)
Browse files Browse the repository at this point in the history
* Update README

* Upgrade vue-cli and eslint as vue-cli services requires eslint packages to work

* Update create-ripple-app template

* Update generator to modify eslint

* Add requireConfigFile:false setting in consuming sites so it doesn't require babel config

* Sync babel plugins to the same version

* Update babel-node and babel-runtime plugin to 7.12.13

Co-authored-by: Ruby Lamadora <[email protected]>
  • Loading branch information
rubyllamadora and Ruby Lamadora authored Feb 15, 2021
1 parent f613739 commit f177592
Show file tree
Hide file tree
Showing 21 changed files with 1,772 additions and 974 deletions.
28 changes: 25 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
allowImportExportEverywhere: true
},
env: {
Expand All @@ -13,7 +13,7 @@ module.exports = {
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard',
"plugin:jest/recommended"
Expand All @@ -28,6 +28,28 @@ module.exports = {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// TODO enable the rules to achieve lint standard consistency towards projects
'array-bracket-spacing': 'off',
'array-callback-return': 'off',
'dot-notation': 'off',
'jest/expect-expect': 'off',
'jest/no-standalone-expect': 'off',
'jest/no-try-expect': 'off',
'jest/no-conditional-expect': 'off',
'lines-between-class-members': 'off',
'multiline-ternary': 'off',
'no-case-declarations': 'off',
'no-prototype-builtins': 'off',
'node/no-deprecated-api': 'off',
'prefer-const': 'off',
'prefer-regex-literals': 'off',
'quotes': ['off', 'single', { 'allowTemplateLiterals': true }],
'quote-props': 'off',
'vue/no-mutating-props': 'off',
'vue/no-unused-components': 'off',
'vue/no-use-v-if-with-v-for': 'off',
'vue/return-in-computed-property': 'off',
'no-var': 'off'
}
}
12 changes: 8 additions & 4 deletions examples/basic-examples/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
allowImportExportEverywhere: true
},
env: {
Expand All @@ -13,10 +13,10 @@ module.exports = {
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard',
"plugin:jest/recommended"
'plugin:jest/recommended'
],
// required to lint *.vue files
plugins: [
Expand All @@ -28,6 +28,10 @@ module.exports = {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'quotes': ['off', 'single', { 'allowTemplateLiterals': true }],
'quote-props': 'off',
'dot-notation': 'off',
'prefer-const': 'off'
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Icon from '@dpc-sdp/ripple-icon/Icon.vue'

Icon.register({
'lock_open': {
lock_open: {
width: 10,
height: 10,
paths: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Icon from '@dpc-sdp/ripple-icon/Icon.vue'

Icon.register({
'search': {
search: {
width: 10,
height: 10,
paths: [
Expand Down
8 changes: 4 additions & 4 deletions examples/basic-examples/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ export default {
const webpack = require('webpack')
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
config.plugins.push(new LodashModuleReplacementPlugin({
'caching': true,
'collections': true,
'paths': true,
'shorthands': true
caching: true,
collections: true,
paths: true,
shorthands: true
}))
// Load moment 'en-au' locale only for performance.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
Expand Down
31 changes: 16 additions & 15 deletions examples/basic-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,32 @@
"run-script-os": "^1.1.3"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/core": "^7.12.13",
"@babel/eslint-parser": "^7.12.13",
"@babel/eslint-plugin": "^7.12.13",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-env": "^7.12.7",
"@babel/runtime": "^7.12.5",
"@babel/plugin-transform-runtime": "^7.12.13",
"@babel/preset-env": "^7.12.13",
"@babel/runtime": "^7.12.13",
"@dpc-sdp/ripple-test-tools": "1.19.8",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^24.8.0",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-require-context-hook": "^1.0.0",
"babel-preset-vue": "^2.0.2",
"core-js": "^3.8.1",
"cross-env": "^5.2.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"cross-env": "^7.0.3",
"eslint": "^7.19.0",
"eslint-config-standard": "^16.0.2",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^21.17.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.5.0",
"lodash-webpack-plugin": "^0.11.5",
"node-sass": "^4.11.0",
"sass-lint": "^1.12.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
// Use your own filter like above is the safer way.
paragraphKeyJourneyLinks: function (fieldParagraphLinks) {
if (typeof fieldParagraphLinks !== 'undefined' && fieldParagraphLinks !== null) {
let rtn = []
const rtn = []
fieldParagraphLinks.forEach(item => {
rtn.push({
url: item.url || item.uri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { RplDivider } from '@dpc-sdp/ripple-global'
import { RplSearchForm, RplSearchResults } from '@dpc-sdp/ripple-search'
// Layout.
import { RplRow, RplCol } from '@dpc-sdp/ripple-grid'
import { RplPageLayout } from '@dpc-sdp/ripple-layout'
import formData from './formdata.js'
import { searchMixin, getSearch } from '@dpc-sdp/ripple-nuxt-tide/modules/search'
Expand All @@ -44,9 +43,7 @@ export default {
RplSearchResults,
// Layout.
RplPageLayout,
RplRow,
RplCol
RplPageLayout
},
mixins: [searchMixin],
async asyncData ({ app, route }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { RplDivider } from '@dpc-sdp/ripple-global'
import { RplSearchForm, RplSearchResults } from '@dpc-sdp/ripple-search'
// Layout.
import { RplRow, RplCol } from '@dpc-sdp/ripple-grid'
import { RplPageLayout } from '@dpc-sdp/ripple-layout'
import formData from './formdata-simple.js'
import { searchMixin, getSearch } from '@dpc-sdp/ripple-nuxt-tide/modules/search'
Expand All @@ -43,9 +42,7 @@ export default {
RplSearchResults,
// Layout.
RplPageLayout,
RplRow,
RplCol
RplPageLayout
},
mixins: [searchMixin],
async asyncData ({ app, route }) {
Expand Down
23 changes: 12 additions & 11 deletions examples/vic-gov-au/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@
"run-script-os": "^1.1.3"
},
"devDependencies": {
"@babel/eslint-parser": "^7.12.13",
"@babel/eslint-plugin": "^7.12.13",
"@dpc-sdp/ripple-test-tools": "1.19.8",
"babel-eslint": "^10.1.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.2.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"cross-env": "^7.0.3",
"eslint": "^7.19.0",
"eslint-config-standard": "^16.0.2",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^21.17.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.5.0",
"lodash-webpack-plugin": "^0.11.5",
"mockttp": "^1.0.3",
"node-sass": "^4.11.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/vue-example-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Two Ripple components installed just for demo how to install them.
Install below dev dependencies in your Vue project to make icon work.

```
npm install sass-resources-loader svgo svgo-loader svg-sprite-loader --save-dev
npm install sass-resources-loader --save-dev
```

### Webpack configs
Expand All @@ -24,7 +24,7 @@ Check [/vue.config.js](/vue.config.js) for more details.

### Using Ripple components

Chceck [/src/App.vue](/src/App.vue) and [/src/components/HelloRipple.vue](/src/components/HelloRipple.vue) for more details.
Check [/src/App.vue](/src/App.vue) and [/src/components/HelloRipple.vue](/src/components/HelloRipple.vue) for more details.

### Install Ripple plugin

Expand Down
21 changes: 10 additions & 11 deletions examples/vue-example-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,20 @@
"vue": "^2.6.12"
},
"devDependencies": {
"@babel/eslint-parser": "^7.12.13",
"@babel/eslint-plugin": "^7.12.13",
"@dpc-sdp/ripple-test-tools": "1.19.8",
"@vue/cli-plugin-babel": "^3.8.0",
"@vue/cli-plugin-eslint": "^3.8.0",
"@vue/cli-service": "^3.8.0",
"babel-eslint": "^10.1.0",
"cross-env": "^5.2.0",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"@vue/babel-preset-app": "^4.5.11",
"@vue/cli-plugin-babel": "^4.5.11",
"@vue/cli-plugin-eslint": "^4.5.11",
"@vue/cli-service": "^4.5.11",
"cross-env": "^7.0.3",
"eslint": "^7.19.0",
"eslint-plugin-vue": "^7.5.0",
"node-sass": "^4.12.0",
"sass-loader": "^7.1.0",
"sass-resources-loader": "^2.1.1",
"start-server-and-test": "^1.11.6",
"svg-sprite-loader": "^4.1.6",
"svgo": "^1.2.2",
"svgo-loader": "^2.2.0",
"vue-template-compiler": "^2.6.12"
},
"eslintConfig": {
Expand All @@ -48,7 +47,7 @@
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
"parser": "@babel/eslint-parser"
}
},
"cypress-cucumber-preprocessor": {
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,32 @@
"package-dependencies:storybook": "cd src/ && yarn run package-dependencies"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/helper-call-delegate": "^7.12.1",
"@babel/core": "^7.12.13",
"@babel/eslint-parser": "^7.12.13",
"@babel/eslint-plugin": "^7.12.13",
"@babel/helper-call-delegate": "^7.12.13",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/helper-call-delegate": "^7.12.1",
"@babel/preset-env": "^7.12.7",
"@babel/plugin-transform-runtime": "^7.12.13",
"@babel/preset-env": "^7.12.13",
"@vue/test-utils": "^1.0.0-beta.29",
"axe-core": "^3.2.2",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^24.8.0",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-require-context-hook": "^1.0.0",
"babel-preset-vue": "^2.0.2",
"core-js": "^3.8.1",
"cross-env": "^5.2.0",
"eslint": "^5.11.1",
"eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^3.0.0",
"cross-env": "^7.0.3",
"eslint": "^7.19.0",
"eslint-config-standard": "^16.0.2",
"eslint-friendly-formatter": "^4.0.1",
"eslint-junit": "^1.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^21.17.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.5.0",
"husky": "^3.0.0",
"jest": "^24.8.0",
"jest-canvas-mock": "^2.1.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/components/Molecules/Card/mixins/cardtrimfield.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ const cardtrimfield = {
// Set the max height of a summary field.
if (typeof window !== 'undefined' && this.$el && this.$el.querySelector && this.$breakpoint.m) {
// Elements
let card = this.$el
let summary = card.querySelector(this.trimFieldSelector)
const card = this.$el
const summary = card.querySelector(this.trimFieldSelector)
if (summary) {
// Properties
let summaryLineHeight = parseFloat(window.getComputedStyle(summary, null).getPropertyValue('line-height'))
const summaryLineHeight = parseFloat(window.getComputedStyle(summary, null).getPropertyValue('line-height'))
let summaryAllowedHeight = this.getTrimFieldMaxHeightOffset(card) - summary.offsetTop
summaryAllowedHeight = summaryLineHeight * Math.floor(summaryAllowedHeight / summaryLineHeight)
// Set Max Height
Expand Down Expand Up @@ -65,7 +65,7 @@ const cardtrimfield = {
this.$nextTick(() => {
if (typeof window !== 'undefined') {
this.setTrimFieldMaxHeight()
window.addEventListener('resize', this.setTrimFieldMaxHeight, { 'passive': true })
window.addEventListener('resize', this.setTrimFieldMaxHeight, { passive: true })
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
"run-script-os": "^1.0.7"
},
"devDependencies": {
"@babel/eslint-parser": "^7.12.13",
"@babel/eslint-plugin": "^7.12.13",
"@dpc-sdp/ripple-test-tools": "^1.3.0",
"axe-core": "^3.3.2",
"babel-eslint": "^10.0.1",
"cross-env": "^5.2.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
Expand Down
Loading

0 comments on commit f177592

Please sign in to comment.