Skip to content

Commit

Permalink
Upgrade JS dependencies and JS build setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Rainville authored and Garion Herman committed Nov 17, 2019
1 parent 5b23043 commit 81ac515
Show file tree
Hide file tree
Showing 11 changed files with 4,410 additions and 1,161 deletions.
34 changes: 34 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Ignore dist files
client/dist/

# Ignore legacy files
client/src/legacy/ConfirmedPasswordField.js
client/src/legacy/GridField.js
client/src/legacy/HtmlEditorField.js
client/src/legacy/InlineFormAction.js
client/src/legacy/PermissionCheckboxSetField.js
client/src/legacy/SelectionGroup.js
client/src/legacy/TabSet.js
client/src/legacy/TinyMCE_SSPlugin.js
client/src/legacy/ToggleCompositeField.js
client/src/legacy/ToggleField.js
client/src/legacy/TreeDropdownField.js
client/src/i18n.js
client/src/i18nx.js
client/src/jQuery.js
client/src/legacy/LeftAndMain.js
client/src/legacy/LeftAndMain.*.js
client/src/legacy/MemberDatetimeOptionsetField.js
client/src/legacy/MemberImportForm.js
client/src/legacy/ModelAdmin.js
client/src/legacy/SecurityAdmin.js
client/src/legacy/leaktools.js
client/src/legacy/sspath.js
client/src/legacy/ssui.core.js

# Ignore vendor
node_modules/
thirdparty/

# Ignore language files (auto-generated)
client/lang/
6 changes: 0 additions & 6 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@silverstripe/eslint-config/.eslintrc');
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
178 changes: 178 additions & 0 deletions .sass-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# sass-lint config to match the AirBNB style guide
files:
include: '**/client/src/**/*.scss'
ignore:
- 'client/src/styles/legacy/*'
- 'admin/client/src/styles/legacy/*'
options:
formatter: stylish
merge-default-rules: false
rules:
# Warnings
# Things that require actual refactoring are marked as warnings
class-name-format:
- 1
- convention: hyphenatedbem
placeholder-name-format:
- 1
- convention: hyphenatedlowercase
nesting-depth:
- 1
- max-depth: 3
no-ids: 1
no-important: 1
no-misspelled-properties:
- 1
- extra-properties:
- "-moz-border-radius-topleft"
- "-moz-border-radius-topright"
- "-moz-border-radius-bottomleft"
- "-moz-border-radius-bottomright"
variable-name-format:
- 1
- allow-leading-underscore: true
convention: hyphenatedlowercase
no-extends: 1

# Warnings: these things are preferential rather than mandatory
no-css-comments: 1

# Errors
# Things that can be easily fixed are marked as errors
indentation:
- 2
- size: 2
final-newline:
- 2
- include: true
no-trailing-whitespace: 2
border-zero:
- 2
- convention: '0'
brace-style:
- 2
- allow-single-line: true
clean-import-paths:
- 2
- filename-extension: false
leading-underscore: false
no-debug: 2
no-empty-rulesets: 2
no-invalid-hex: 2
no-mergeable-selectors: 2
# no-qualifying-elements:
# - 1
# - allow-element-with-attribute: false
# allow-element-with-class: false
# allow-element-with-id: false
no-trailing-zero: 2
no-url-protocols: 2
quotes:
- 2
- style: double
space-after-bang:
- 2
- include: false
space-after-colon:
- 2
- include: true
space-after-comma:
- 2
- include: true
space-before-bang:
- 2
- include: true
space-before-brace:
- 2
- include: true
space-before-colon: 2
space-between-parens:
- 2
- include: false
trailing-semicolon: 2
url-quotes: 2
zero-unit: 2
single-line-per-selector: 2
one-declaration-per-line: 2
empty-line-between-blocks:
- 2
- ignore-single-line-rulesets: true


# Missing rules
# There are no sass-lint rules for the following AirBNB style items, but thess
# - Put comments on their own line
# - Put property delcarations before mixins

# Disabled rules

# These are other rules that we may wish to consider using in the future
# They are not part of the AirBNB CSS standard but they would introduce some strictness
# bem-depth: 0
# variable-for-property: 0
# no-transition-all: 0
# hex-length:
# - 1
# - style: short
# hex-notation:
# - 1
# - style: lowercase
# property-units:
# - 1
# - global:
# - ch
# - em
# - ex
# - rem
# - cm
# - in
# - mm
# - pc
# - pt
# - px
# - q
# - vh
# - vw
# - vmin
# - vmax
# - deg
# - grad
# - rad
# - turn
# - ms
# - s
# - Hz
# - kHz
# - dpi
# - dpcm
# - dppx
# - '%'
# per-property: {}
# force-attribute-nesting: 1
# force-element-nesting: 1
# force-pseudo-nesting: 1
# function-name-format:
# - 1
# - allow-leading-underscore: true
# convention: hyphenatedlowercase
# no-color-literals: 1
# no-duplicate-properties: 1
# mixin-name-format:
# - 1
# - allow-leading-underscore: true
# convention: hyphenatedlowercase
# shorthand-values:
# - 1
# - allowed-shorthands:
# - 1
# - 2
# - 3
# leading-zero:
# - 1
# - include: false
# no-vendor-prefixes:
# - 1
# - additional-identifiers: []
# excluded-identifiers: []
# placeholder-in-extend: 1
# no-color-keywords: 2
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ matrix:
- php: 7.2
env: DB=MYSQL RECIPE_VERSION=4.5.x-dev PHPUNIT_TEST=1
- php: 7.3
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1 NPM_TEST=1

before_script:
# Init PHP
Expand All @@ -26,10 +26,15 @@ before_script:
- composer require --prefer-dist --no-update silverstripe/recipe-cms "$RECIPE_VERSION"
- composer update

# Install NPM dependencies
- if [[ $NPM_TEST ]]; then nvm install && nvm use && npm install -g yarn && yarn install --network-concurrency 1 && (cd vendor/silverstripe/admin && yarn install --network-concurrency 1) && yarn run build; fi

script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi
- if [[ $NPM_TEST ]]; then git diff-files --quiet -w --relative=client; fi
- if [[ $NPM_TEST ]]; then git diff --name-status --relative=client; fi

after_success:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
2 changes: 1 addition & 1 deletion client/dist/js/segment-field.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/dist/js/segment-field.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/src/bundles/segment-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ window.jQuery.entwine('ss', ($) => {
callback(data, this);
},
error(xhr) {
/* eslint no-param-reassign: ["error", { "props": false }]*/
/* eslint no-param-reassign: ["error", { "props": false }] */
xhr.statusText = xhr.responseText;
},
complete() {
Expand Down
26 changes: 12 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
{
"scripts": {
"build": "yarn && NODE_ENV=production webpack -p --bail --progress",
"watch": "yarn && NODE_ENV=development webpack --watch --progress",
"scripts": {
"build": "yarn && yarn lint && NODE_ENV=production webpack -p --bail --progress",
"dev": "NODE_ENV=development webpack --progress",
"watch": "NODE_ENV=development webpack --watch --progress",
"css": "WEBPACK_CHILD=css npm run build",
"lint": "eslint client/src; sass-lint -v -c ../silverstripe-admin/.sass-lint.yml"
"lint": "eslint client/src && sass-lint client/src",
"lint-js": "eslint client/src",
"lint-js-fix": "eslint client/src --fix",
"lint-sass": "sass-lint client/src"
},
"devDependencies": {
"@silverstripe/webpack-config": "^0.2.5",
"babel-core": "^6.7.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"eslint": "^2.7.0",
"eslint-config-airbnb": "^6.2.0",
"eslint-plugin-react": "^4.3.0"
"devDependencies": {
"@silverstripe/webpack-config": "^1.3",
"@silverstripe/eslint-config": "^0.0.5"
},
"dependencies": {
"babel-preset-es2016": "^6.24.1",
"jquery": "^3.2.1"
},
"engines": {
"node": "^6.x"
"node": "^10.x"
}
}
Loading

0 comments on commit 81ac515

Please sign in to comment.