Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #2

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .eslintrc

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
node-version: '20'

- name: Build ui-bundle
run: npm ci && gulp lint && gulp bundle
run: |
npm ci
gulp bundle

- name: Save build-artifacts
uses: actions/upload-artifact@v4
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- name: Build ui-bundle
run: |
npm ci
gulp lint
gulp bundle

- name: Create draft Release
Expand Down
7 changes: 7 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
"extends": "stylelint-config-standard",
"rules": {
"comment-empty-line-before": null,
"media-feature-range-notation": null,
"no-descending-specificity": null,
"property-no-unknown": [
true,
{
"ignoreProperties": ["print-color-adjust", "#due to deprecated gulp-stylelint"]
}
]
}
}
27 changes: 26 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
{}
{
"cSpell.words": [
"accum",
"Antora",
"asciidoctor",
"clippy",
"cmds",
"cssnano",
"fontsource",
"gifsicle",
"gulpfile",
"highlightjs",
"jpegtran",
"listingblock",
"literalblock",
"mozjpeg",
"openems",
"optipng",
"ospath",
"roboto",
"sectionbody",
"stylelint",
"substr"
],
"asciidoc.antora.enableAntoraSupport": true
}
37 changes: 37 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import js from '@eslint/js'
import globals from 'globals'

export default [
js.configs.recommended,
{
languageOptions: {
globals: {
...globals.browser,
...globals.es2021,
...globals.node,
},
},
rules: {
"no-unused-vars": "off",
"arrow-parens": ["error", "always"],
"comma-dangle": ["error",
{
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
exports: "always-multiline",
},
],
"no-restricted-properties": [
"error",
{
property: "substr",
message: "Use String #slice instead",
},
],
"max-len": ["warn", 128, 2],
"spaced-comment": "off",
"radix": ["error", "always"],
},
},
];
6 changes: 3 additions & 3 deletions gulp.d/lib/create-task.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict'

const metadata = require('undertaker/lib/helpers/metadata')
const { watch } = require('gulp')
import metadata from 'undertaker/lib/helpers/metadata.js'
import { watch } from 'gulp'

module.exports = ({ name, desc, opts, call: fn, loop }) => {
export default ({ name, desc, opts, call: fn, loop }) => {
if (name) {
const displayName = fn.displayName
if (displayName === '<series>' || displayName === '<parallel>') {
Expand Down
14 changes: 0 additions & 14 deletions gulp.d/lib/export-tasks.js

This file was deleted.

145 changes: 145 additions & 0 deletions gulp.d/lib/gulp-eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
'use strict'

import { Transform } from 'stream'
import PluginError from 'plugin-error'
import { ESLint } from 'eslint'
import relative from 'path'
import fancyLog from 'fancy-log'

let linter = null

/**
* Convenience method for creating a transform stream in object mode
*
* @param {Function} transform - An async function that is called for each stream chunk
* @param {Function} [flush] - An async function that is called before closing the stream
* @returns {stream} A transform stream
*/
function transform (transform, flush) {
return new Transform({
objectMode: true,
transform,
flush,
})
}

/**
* Mimic the CLIEngine's createIgnoreResult function,
* only without the ESLint CLI reference.
*
* @param {Object} file - file with a "path" property
* @returns {Object} An ESLint report with an ignore warning
*/
function createIgnoreResult (file) {
return {
filePath: file.path,
messages: [{
fatal: false,
severity: 1,
message: file.path.includes('node_modules/')
? 'File ignored because it has a node_modules/** path'
: 'File ignored because of .eslintignore file',
}],
errorCount: 0,
warningCount: 1,
}
}

/**
* Append ESLint result to each file
*
* @returns {stream} gulp file stream
*/
function eslint () {
linter = new ESLint()

return transform(async (file, enc, cb) => {
const filePath = relative.join(process.cwd(), file.path)

if (file.isNull()) {
cb(null, file)
return
}

if (file.isStream()) {
cb(new PluginError('gulp-eslint', 'gulp-eslint doesn\'t support vinyl files with Stream contents.'))
return
}

const ignored = await linter.isPathIgnored(filePath)
if (ignored) {
file.eslint = createIgnoreResult(file)
cb(null, file)
return
}

try {
const result = await linter.lintText(file.contents.toString(), { filePath })
file.eslint = result[0] // ESLint lintText returns an array of results
if (file.eslint.output) {
file.contents = Buffer.from(file.eslint.output)
file.eslint.fixed = true
}
cb(null, file)
} catch (e) {
cb(new PluginError('gulp-eslint', e))
}
})
}

/**
* Handle all ESLint results at the end of the stream.
*
* @param {Function} action - A function to handle all ESLint results
* @returns {stream} gulp file stream
*/
function results (action) {
const results = []
results.errorCount = 0
results.warningCount = 0

return transform((file, enc, cb) => {
if (file.eslint) {
results.push(file.eslint)
results.errorCount += file.eslint.errorCount
results.warningCount += file.eslint.warningCount
}
cb(null, file)
}, async (done) => {
Promise.resolve(action(results)).then(() => done()).catch(done)
})
}

/**
* Fail when the stream ends if any ESLint error(s) occurred
*
* @returns {stream} gulp file stream
*/
eslint.failAfterError = () => {
return results((results) => {
if (results.errorCount > 0) {
throw new PluginError('gulp-eslint',
`Failed with ${results.errorCount} ${results.errorCount === 1 ? 'error' : 'errors'}`)
}
})
}

/**
* Wait until all files have been linted and format all results at once.
*
* @returns {stream} gulp file stream
*/
eslint.format = () => {
const formatterPromise = linter.loadFormatter()

return results(async (results) => {
if (results.length) {
const message = (await formatterPromise).format(results)
if (message) {
fancyLog(message)
}
}
})
}

export default eslint
10 changes: 5 additions & 5 deletions gulp.d/lib/gulp-prettier-eslint.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

const log = require('fancy-log')
const PluginError = require('plugin-error')
const prettierEslint = require('prettier-eslint')
const { Transform } = require('stream')
import log from 'fancy-log'
import PluginError from 'plugin-error'
import prettierEslint from 'prettier-eslint'
import { Transform } from 'stream'
const map = (transform) => new Transform({ objectMode: true, transform })

module.exports = () => {
export default () => {
const report = { changed: 0, unchanged: 0 }
return map(format).on('finish', () => {
if (report.changed > 0) {
Expand Down
Loading