Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
refactor(js): add max line length (#43)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikita Almanov <131481562+nikkeyl@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and nikkeyl committed Jan 26, 2024
1 parent c815f1f commit bde2167
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 29 deletions.
3 changes: 2 additions & 1 deletion src/converters/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const convertFont = (taskName, extension) => {
return src(woff2).pipe(errorMessage).pipe(dest(fontsBuild));
}

const selectPlugin = extension === 'otf' ? fonter({ formats: ['ttf'] }) : ttf2woff2();
const selectPlugin =
extension === 'otf' ? fonter({ formats: ['ttf'] }) : ttf2woff2();

return src(join(fontsSource, `*.${extension}`))
.pipe(errorMessage)
Expand Down
4 changes: 1 addition & 3 deletions src/generators/font-face.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ const {

const generateFontFace = async (
fontFacesFile,
{
fontFileName, fontFamily, fontWeight, fontStyle,
},
{ fontFileName, fontFamily, fontWeight, fontStyle },
) => {
const fontFileURL = `src: url("../fonts/${fontFileName}.woff2") format("woff2")`;
const fontFamilyName = `font-family: "${fontFamily}";`;
Expand Down
3 changes: 2 additions & 1 deletion src/handlers/fonts/font-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ const fontFileHandler = (fontsFiles) => {

if (newFileOnly !== fontFileName) {
const [fontFamily, fontWeightValue] = fontFileName.split('-');
const fontWeight = FONT_WEIGHTS[trimString(fontWeightValue, ITALIC_REGEX) ?? 'regular'];
const fontWeight =
FONT_WEIGHTS[trimString(fontWeightValue, ITALIC_REGEX) ?? 'regular'];
const fontStyle = ITALIC_REGEX.test(fontFileName) ? 'italic' : 'normal';

generateFontFace(fontFacesFile, {
Expand Down
3 changes: 2 additions & 1 deletion src/handlers/js/js-development.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ webPackBeautifyConfig.optimization = {
};
webPackBeautifyConfig.output = outputConfig(`${entry ?? 'main'}.js`);

const JSDevelopmentHandler = () => formatterJS('JSDevelopmentHandler', webPackBeautifyConfig);
const JSDevelopmentHandler = () =>
formatterJS('JSDevelopmentHandler', webPackBeautifyConfig);

export default JSDevelopmentHandler;
21 changes: 12 additions & 9 deletions src/helpers/notifier.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,22 @@ class Notifier extends FormatterMessage {
super(isEnabled);
}

errorHandler = (taskName) => plumber({
errorHandler: onError({
title: `Error: ${taskName}`,
message: 'Error: <%= error.message %>',
sound: sound ?? 'Pop',
}),
});
errorHandler = (taskName) =>

Check failure on line 40 in src/helpers/notifier.class.js

View workflow job for this annotation

GitHub Actions / Lint

Expected 'this' to be used by class method 'errorHandler'

Check failure on line 40 in src/helpers/notifier.class.js

View workflow job for this annotation

GitHub Actions / Lint

Expected 'this' to be used by class method 'errorHandler'

Check failure on line 40 in src/helpers/notifier.class.js

View workflow job for this annotation

GitHub Actions / Lint

Expected 'this' to be used by class method 'errorHandler'
plumber({
errorHandler: onError({
title: `Error: ${taskName}`,
message: 'Error: <%= error.message %>',
sound: sound ?? 'Pop',
}),
});

success = (taskName, options) => this.message(taskName, options);

warning = (taskName, options) => this.message(taskName, options, this.#SEVERITY_LEVELS.WARNING);
warning = (taskName, options) =>
this.message(taskName, options, this.#SEVERITY_LEVELS.WARNING);

error = (taskName, options) => this.message(taskName, options, this.#SEVERITY_LEVELS.ERROR);
error = (taskName, options) =>
this.message(taskName, options, this.#SEVERITY_LEVELS.ERROR);
}

const notifier = new Notifier(isNotify ?? true);
Expand Down
4 changes: 3 additions & 1 deletion src/helpers/pug-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const {
} = PLUGINS;
const { PUG_EXTENSION } = REGEXPS;

const pugPages = readdirSync(join(SRC_FOLDER, PAGES_FOLDER)).filter((extension) => extension.endsWith(PUG_EXTENSION));
const pugPages = readdirSync(join(SRC_FOLDER, PAGES_FOLDER)).filter((extension) =>

Check failure on line 31 in src/helpers/pug-pages.js

View workflow job for this annotation

GitHub Actions / Lint

This line has a length of 118. Maximum allowed is 100

Check failure on line 31 in src/helpers/pug-pages.js

View workflow job for this annotation

GitHub Actions / Lint

This line has a length of 118. Maximum allowed is 100

Check failure on line 31 in src/helpers/pug-pages.js

View workflow job for this annotation

GitHub Actions / Lint

This line has a length of 118. Maximum allowed is 100
extension.endsWith(PUG_EXTENSION),
);

export default pugPages;
3 changes: 2 additions & 1 deletion src/helpers/trim-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
//
/// /////////////////////////////////////////////////////////////////////////

const trimString = (string, regex) => string?.toString().replace(regex, '').toLowerCase();
const trimString = (string, regex) =>
string?.toString().replace(regex, '').toLowerCase();

export default trimString;
3 changes: 2 additions & 1 deletion src/utilities/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const { removes } = PROJECT_CONFIG;
const { GIT_KEEP_FILE, buildFolder, cacheFolder } = PATHS;
const { deleteAsync } = PLUGINS;

const reset = () => deleteAsync([GIT_KEEP_FILE, cacheFolder, buildFolder, ...(removes ?? [])]);
const reset = () =>
deleteAsync([GIT_KEEP_FILE, cacheFolder, buildFolder, ...(removes ?? [])]);

export default reset;
27 changes: 16 additions & 11 deletions src/webpack/webpack.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import serverConfig from './webpack.server.js';

const {
entry,
server: {
port, publicFolder, sourceMapType, stats, watchFiles,
},
server: { port, publicFolder, sourceMapType, stats, watchFiles },
} = PROJECT_CONFIG;
const {
ASSETS_FOLDER,
Expand Down Expand Up @@ -57,17 +55,24 @@ export default {
devServer: serverConfig({
port,
publicFolder,
watchFiles: [imagesSource, jsonSource, markdownSource, pugSource, ...(watchFiles ?? [])],
watchFiles: [
imagesSource,
jsonSource,
markdownSource,
pugSource,
...(watchFiles ?? []),
],
}),
plugins: [
...pugPages.map(
(pugPage) => new HtmlWebpackPlugin({
filename: pugPage.replace(PUG_EXTENSION_REGEX, HTML_EXTENSION),
inject: false,
minify: false,
production: false,
template: join(SRC_FOLDER, PAGES_FOLDER, pugPage),
}),
(pugPage) =>
new HtmlWebpackPlugin({
filename: pugPage.replace(PUG_EXTENSION_REGEX, HTML_EXTENSION),
inject: false,
minify: false,
production: false,
template: join(SRC_FOLDER, PAGES_FOLDER, pugPage),
}),
),
new CopyPlugin({
patterns: [
Expand Down

0 comments on commit bde2167

Please sign in to comment.