Skip to content

Commit

Permalink
Merge branch 'release/1.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Igloczek committed Sep 18, 2020
2 parents d1cfb92 + 40ebf14 commit c9dea33
Show file tree
Hide file tree
Showing 11 changed files with 4,816 additions and 4,191 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ Please use `yarn [taskName]` or `npm run [taskName]` to avoid necessity of insta
* `--disableMaps` - Disable inline source maps generation.
* `emailfix` - Fixes email stylesheet for Magento < 2.3.0. [Related issue](https://github.com/MyIntervals/emogrifier/issues/296)
* `--prod` - Production output - minifies styles and add `.min` sufix.
* `eslint` - Watch and run [eslint](https://github.com/adametry/gulp-eslint) on specified JS file.
* `--file fileName` - You have to specify what file you want to lint, fileName without .js.
* `eslint` - Run [eslint](https://github.com/adametry/gulp-eslint) against all JS files.
* `--theme name` - Process single theme.
* `--ci` - Enable throwing errors. Useful in CI/CD pipelines.
* `inheritance` - Create necessary symlinks to resolve theme styles inheritance and make the base for styles processing. You have to run in before styles compilation and after adding new files.
* `sasslint` - Run [sass-lint](https://github.com/sasstools/sass-lint) based tests.
* `--theme name` - Process single theme.
Expand Down
78 changes: 31 additions & 47 deletions config/.eslintrc.sample
Original file line number Diff line number Diff line change
@@ -1,51 +1,35 @@
extends:
- eslint:recommended
- idiomatic
parserOptions:
ecmaVersion: 2017
sourceType: module
env:
node: true
browser: true
amd: true
es6: true
jquery: true
rules:
indent: 0
brace-style: [2, "stroustrup"]
comma-style: [2, "last"]
default-case: 2
func-style: [2, "declaration"]
no-floating-decimal: 2
no-nested-ternary: 2
no-undefined: 2
radix: 2
space-before-function-paren: [2, "never"]
space-after-keywords: [1, "always"]
space-before-blocks: 2
spaced-comment: [2, "always", { exceptions: ["-"] }]
valid-jsdoc: [1, { requireReturn: false, prefer: { return: "returns" }}]
wrap-iife: [2, "inside"]
guard-for-in: 1
strict: [2, "global"]
global-strict: 0
camelcase: 1
curly: [2, "all"]
eqeqeq: [2, "allow-null"]
no-empty: 1
no-underscore-dangle: 0
no-use-before-define: 1
no-obj-calls: 2
no-unused-vars: [0, {"vars": "local", "args": "after-used"}]
new-cap: 2
no-shadow: 1
no-invalid-regexp: 2
comma-dangle: [2, "never"]
no-undef: 2
no-new: 2
no-extra-semi: 2
no-caller: 1
semi: 2
quotes: [1, "single"]
no-unreachable: 2
eol-last: 1
no-alert: 2
no-debugger: 2
no-console: 2
globals:
jQuery: false
$j: true
no-multi-spaces: 0
space-in-parens: 0
array-bracket-spacing: 0
computed-property-spacing: 0
key-spacing: 0
no-var: 2
indent:
- 2
- 2
-
VariableDeclarator:
var: 2
let: 2
const: 3
brace-style:
- 2
- 'stroustrup'
-
allowSingleLine: false
one-var:
- 2
- never
semi:
- 2
- never
2 changes: 1 addition & 1 deletion config/eslint.json.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"configFile": "./config/.eslintrc"
"configFile": "../../../dev/tools/frontools/config/.eslintrc"
}
1 change: 1 addition & 0 deletions config/themes.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"locale": ["en_US", "pl_PL"],
"parent": "blank",
"stylesDir": "web/css",
"includePaths": ["../../../node_modules"],
"postcss": ["autoprefixer()"],
"disableSuffix": true,
"modules": {
Expand Down
2 changes: 2 additions & 0 deletions gulpfile.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { browserSync as browserSyncTask } from './tasks/browser-sync'
import { clean as cleanTask } from './tasks/clean'
import { csslint as cssLintTask } from './tasks/css-lint'
import { emailFix as emailFixTask } from './tasks/email-fix'
import { eslint as eslintTask } from './tasks/eslint'
import { inheritance as inheritanceTask } from './tasks/inheritance'
import { sasslint as sassLintTask } from './tasks/sass-lint'
import { setup as setupTask } from './tasks/setup'
Expand All @@ -19,6 +20,7 @@ export const clean = cleanTask
export const csslint = cssLintTask
export const dev = series(pipelineHelper, inheritanceTask, babelTask, stylesTask, browserSyncTask, watchTask)
export const emailfix = emailFixTask
export const eslint = eslintTask
export const inheritance = inheritanceTask
export const sasslint = sassLintTask
export const setup = setupTask
Expand Down
34 changes: 34 additions & 0 deletions helpers/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import path from 'path'
import { src } from 'gulp'
import globby from 'globby'
import eslint from 'gulp-eslint'
import plumber from 'gulp-plumber'
import gulpIf from 'gulp-if'
import notify from 'gulp-notify'
import logger from 'gulp-logger'

import { env, themes, projectPath } from './config'
import configLoader from './config-loader'

export default (name, file) => {
const theme = themes[name]
const srcBase = path.join(projectPath, theme.dest)
const eslintConfig = configLoader('eslint.json')
const files = globby.sync(srcBase + '/**/*.js')

return src(file ? file : files.length ? files : '.')
.pipe(gulpIf(
!env.ci,
plumber({
errorHandler: notify.onError('Error: <%= error.message %>')
})
))
.pipe(eslint(eslintConfig))
.pipe(eslint.format())
.pipe(eslint.failAfterError())
.pipe(logger({
display : 'name',
beforeEach: 'Theme: ' + name + ' ' + 'File: ',
afterEach : ' - ESLint finished.'
}))
}
3 changes: 2 additions & 1 deletion helpers/scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function(name, file) {
const dest = []
const disableMaps = env.disableMaps || false
const production = env.prod || false
const includePaths = theme.includePaths ? theme.includePaths : []
const postcssConfig = []
const disableSuffix = theme.disableSuffix || false
const browserslist = configLoader('browserslist.json')
Expand Down Expand Up @@ -64,7 +65,7 @@ export default function(name, file) {
)
)
.pipe(gulpIf(!disableMaps, sourcemaps.init()))
.pipe(sass().on('error', sassError(env.ci || false)))
.pipe(sass({ includePaths: includePaths }).on('error', sassError(env.ci || false)))
.pipe(gulpIf(production, postcss([cssnano()])))
.pipe(gulpIf(postcssConfig.length, postcss(postcssConfig || [])))
.pipe(gulpIf(production && !disableSuffix, rename({ suffix: '.min' })))
Expand Down
Loading

0 comments on commit c9dea33

Please sign in to comment.