Skip to content

Commit

Permalink
fix(all): Run blank-line-declaration-usage autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
kresimir-coko committed Nov 16, 2021
1 parent 97fba4b commit f5a85cd
Show file tree
Hide file tree
Showing 187 changed files with 539 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function assertTasksSupported(version, tasks) {
default:
{
const message = getSupportedTasks(task)[version] || '';

if (message !== true) {
log(
colors.yellow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ it('_promptThemeSource should prompt correct workflow', () => {
prototype._promptThemeSource();

const args = inquirer.prompt.getCall(0).args;

const questions = args[0];

const extendType = questions[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ it('getModuleChoices should get module choices that are appropriate for extend t

_.forEach(choices, (item, index) => {
const number = index + 1;

const name = 'themelet-' + number;

expect(item.name).toBe(name);
Expand All @@ -78,6 +79,7 @@ it('getModuleChoices should get module choices that are appropriate for extend t

_.forEach(choices, (item, index) => {
const number = index + 1;

const name = 'themelet-' + number;

if (number === 1) {
Expand All @@ -93,6 +95,7 @@ it('getModuleChoices should get module choices that are appropriate for extend t

_.forEach(choices, (item, index) => {
const number = index + 1;

const name = 'themelet-' + number;

expect(!item.checked).toBe(true);
Expand All @@ -106,6 +109,7 @@ it('getModuleChoices should get module choices that are appropriate for extend t

_.forEach(choices, (item, index) => {
const number = index + 1;

const name = 'themelet-' + number;

if (number === 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ExtendPrompt {
const baseTheme = this.themeConfig.baseTheme;
const module = answers.module;
const modulePackages = answers.modules;

const pkg = modulePackages[module];

if (!module) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ function getLiferayThemeModuleFromURL(url) {
// Just in case package name doesn't match URL basename, read it.

const {dependencies} = JSON.parse(fs.readFileSync('package.json'));

const themeName = Object.keys(dependencies)[0];

const json = path.join('node_modules', themeName, 'package.json');

config = JSON.parse(fs.readFileSync(json));
});

Expand Down Expand Up @@ -183,6 +185,7 @@ module.exports = {
*/
function withScratchDirectory(cb) {
const template = path.join(os.tmpdir(), 'theme-finder-');

const directory = fs.mkdtempSync(template);

const cwd = process.cwd();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ module.exports = function (options) {
.pipe(
plugins.filter((file) => {
const extname = path.extname(file.path).slice(1);

const basename = path.basename(file.path, `.${extname}`);

if (promptResults[basename][extname]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const lfrThemeConfig = require('./liferay_theme_config');
const argv = minimist(process.argv.slice(2));

const pkg = lfrThemeConfig.getConfig(true);

const themeConfig = pkg.liferayTheme;

const CUSTOM_DEP_PATH_ENV_VARIABLE_MAP = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe('using lib_sass', () => {

function _assertFixAtDirectives(cb) {
const cssPath = path.join(buildPath, 'css');

const mainCssPath = path.join(cssPath, 'main.css');

expect(fs.existsSync(cssPath)).toBe(true);
Expand Down Expand Up @@ -195,6 +196,7 @@ describe('using lib_sass', () => {
expect(fs.existsSync(templatesPath)).toBe(true);

const customCSSFileName = '_custom.scss';

const customCSSPath = path.join(cssPath, customCSSFileName);

const fileContent = testUtil.stripNewlines(
Expand Down Expand Up @@ -288,6 +290,7 @@ describe('using lib_sass', () => {
expect(fs.existsSync(velocityPath)).toBe(true);

const customCSSFileName = '_custom.scss';

const customCSSPath = path.join(buildPath, 'css', customCSSFileName);

expect(fs.readFileSync(customCSSPath).toString()).toMatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ beforeEach(() => {
namespace: 'status_task',
registerTasks: true,
});

runSequence = config.runSequence;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const DEPLOYMENT_STRATEGIES = themeUtil.DEPLOYMENT_STRATEGIES;

function registerTasks(options) {
const {argv, gulp, pathDist} = options;

const {storage} = gulp;

const runSequence = require('run-sequence').use(gulp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ module.exports = function (options) {

gulp.task('watch:reload', (cb) => {
const changedFile = storage.get('changedFile');

const srcPath = path.relative(process.cwd(), changedFile.path);

const dstPath = srcPath.replace(/^src\//, '');

const urlPath = `${resourcePrefix}/${distName}/${dstPath}`;

livereload.changed({
Expand Down Expand Up @@ -276,8 +279,10 @@ module.exports = function (options) {
const requestUrl = url.parse(req.url);

const match = themePattern.exec(requestUrl.pathname);

if (match) {
const filepath = path.resolve('build', match[3]);

const ext = path.extname(filepath);

isReadable(filepath).then((exists) => {
Expand Down Expand Up @@ -307,9 +312,11 @@ module.exports = function (options) {
`Watch mode is now active at: ${url}`,
`Proxying: ${proxyUrl}`,
];

const width = messages.reduce((max, line) => {
return Math.max(line.length, max);
}, 0);

const ruler = '-'.repeat(width);

// eslint-disable-next-line no-console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ module.exports = class extends Generator {
const cp = new Copier(this);

const {layoutId, liferayVersion} = this.answers;

const layoutName = snakeCase(layoutId);

const templateFilename = `${layoutName}.ftl`;
const thumbnailFilename = `${layoutName}.png`;

Expand Down Expand Up @@ -71,6 +73,7 @@ module.exports = class extends Generator {

_getDevDependencies() {
const {liferayVersion} = this.answers;

const devDependencies = devDependenciesMap[liferayVersion].default;

return JSON.stringify(devDependencies, null, 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ module.exports = class extends Generator {
const cp = new Copier(this);

const {layoutId, liferayVersion} = this.answers;

const layoutName = snakeCase(layoutId);

const templateFilename = `${layoutName}.ftl`;
const thumbnailFilename = `${layoutName}.png`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module.exports = class Copier {
*/
copyDir(src, {context = {}} = {}) {
const gen = this._generator;

const files = fs.readdirSync(gen.templatePath(src));

files.forEach((file) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Project {

get type() {
const {fs} = this._generator;

const pkgJson = fs.readJSON('package.json');

if (pkgJson === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const pipeline = promisify(stream.pipeline);

async function writing(generator, themeName) {
const project = new Project(generator);

const {liferayVersion} = project;

print(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports.registerTasks = function (options) {

function register(options) {
const gulp = (options.gulp = plugins.help(options.gulp));

const store = gulp.storage;

store.set('changedFile');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe('resolveDependency()', () => {
const resolved = util.resolveDependency(
'liferay-frontend-theme-styled'
);

expect(resolved).toContain(process.cwd());
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ it('_promptThemeSource should prompt correct workflow', () => {
prototype._promptThemeSource();

const args = inquirer.prompt.getCall(0).args;

const questions = args[0];

const extendType = questions[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ it('getModuleChoices should get module choices that are appropriate for extend t

_.forEach(choices, (item, index) => {
const number = index + 1;

const name = 'themelet-' + number;

expect(item.name).toBe(name);
Expand All @@ -78,6 +79,7 @@ it('getModuleChoices should get module choices that are appropriate for extend t

_.forEach(choices, (item, index) => {
const number = index + 1;

const name = 'themelet-' + number;

if (number === 1) {
Expand All @@ -93,6 +95,7 @@ it('getModuleChoices should get module choices that are appropriate for extend t

_.forEach(choices, (item, index) => {
const number = index + 1;

const name = 'themelet-' + number;

expect(!item.checked).toBe(true);
Expand All @@ -106,6 +109,7 @@ it('getModuleChoices should get module choices that are appropriate for extend t

_.forEach(choices, (item, index) => {
const number = index + 1;

const name = 'themelet-' + number;

if (number === 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class ExtendPrompt {
const baseTheme = this.themeConfig.baseTheme;
const module = answers.module;
const modulePackages = answers.modules;

const pkg = modulePackages[module];

if (!module) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class URLPackagePrompt {
if (this.themelet && answers.module) {
Object.keys(answers.module).forEach((k) => {
const moduleName = this.config.selectedModules[k];

answers.module[moduleName] = answers.module[k];
delete answers.module[k];
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ module.exports = function (css, options) {

function updatePosition(str) {
var lines = str.match(/\n/g);

if (lines) {
lineno += lines.length;
}
var i = str.lastIndexOf('\n');

column = ~i ? str.length - i : column + str.length;
}

Expand Down Expand Up @@ -80,6 +82,7 @@ module.exports = function (css, options) {

function error(msg, start) {
var err = new Error(`${filename} (${lineno}:${column}) ${msg}`);

err.position = new Position(start);
err.filename = filename;
err.description = msg;
Expand Down Expand Up @@ -142,10 +145,12 @@ module.exports = function (css, options) {

function match(re) {
var m = re.exec(css);

if (!m) {
return;
}
var str = m[0];

updatePosition(str);
css = css.slice(str.length);

Expand Down Expand Up @@ -211,6 +216,7 @@ module.exports = function (css, options) {

function selector() {
var m = match(/^([^{]+)/);

if (!m) {
return;
}
Expand All @@ -232,6 +238,7 @@ module.exports = function (css, options) {
// prop

var prop = match(/^(\*?[-#/*\w]+(\[[0-9a-z_-]+\])?)\s*/);

if (!prop) {
return;
}
Expand All @@ -246,6 +253,7 @@ module.exports = function (css, options) {
// val

var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/);

if (!val) {
return error('property missing value');
}
Expand Down Expand Up @@ -462,6 +470,7 @@ module.exports = function (css, options) {
function atpage() {
var pos = position();
var m = match(/^@page */);

if (!m) {
return;
}
Expand Down Expand Up @@ -499,6 +508,7 @@ module.exports = function (css, options) {
function atdocument() {
var pos = position();
var m = match(/^@([-\w]+)?document *([^{]+)/);

if (!m) {
return;
}
Expand Down Expand Up @@ -585,10 +595,12 @@ module.exports = function (css, options) {
function _atrule(name) {
var pos = position();
var m = match(new RegExp('^@' + name + ' *([^;\\n]+);'));

if (!m) {
return;
}
var ret = {type: name};

ret[name] = trim(m[1]);

return pos(ret);
Expand Down
Loading

0 comments on commit f5a85cd

Please sign in to comment.