Skip to content

Commit

Permalink
chore: run prettier (dequelabs#3725)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers authored Oct 17, 2022
1 parent 322e9ed commit dfc5643
Show file tree
Hide file tree
Showing 601 changed files with 7,097 additions and 6,878 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ workflows:
triggers:
- schedule:
# run at 00:00 UTC every day
cron: "0 0 * * *"
cron: '0 0 * * *'
filters:
branches:
only:
Expand All @@ -380,4 +380,4 @@ workflows:
- dependencies_unix
- test_nightly_aria_practices:
requires:
- dependencies_unix
- dependencies_unix
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ body:
attributes:
label: Description
validations:
required: true
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ body:
label: Feature Description
description: What do you wish the product did? If the feature is about adding a new rule to axe-core, please follow our [rule template](https://github.com/dequelabs/axe-core/blob/develop/doc/rule-proposal.md).
validations:
required: true
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ body:
attributes:
label: Question
validations:
required: true
required: true
2 changes: 1 addition & 1 deletion .github/axe-linter.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
exclude:
- CHANGELOG.md
- test/**/*
- test/**/*
2 changes: 1 addition & 1 deletion .github/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pending_description: Pull request not yet approved for security and a correct PR
pending_summary: >
Awaiting security and PR title review. To approve this pull request, please click the "Approve" button above.
You may **not** review your own Pull Request.
approved_description: Pull request has been reviewed and approved for security and a correct PR title
approved_summary: Pull request has been approved for security and having an incorrect PR title by @${approver}.

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/label-extension-linter-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
uses: andymckay/[email protected]
if: contains(toJson(github.event.issue.body), '### Product\n\naxe Extension\n\n')
with:
add-labels: "extension"
add-labels: 'extension'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Label Linting Issues
uses: andymckay/[email protected]
if: contains(toJson(github.event.issue.body), '### Product\n\naxe Linter\n\n')
with:
add-labels: "linting"
repo-token: ${{ secrets.GITHUB_TOKEN }}
add-labels: 'linting'
repo-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/sync-master-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
- uses: dequelabs/action-sync-branches@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-title: "chore: merge master into develop"
pr-title: 'chore: merge master into develop'
pr-reviewers: straker,WilcoFiers,stephenmathieson
2 changes: 1 addition & 1 deletion .github/workflows/update-generated-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
git commit -m "chore: sync generated files"
git push origin $BRANCH_NAME
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions axe-linter.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# See: https://marketplace.visualstudio.com/items?itemName=deque-systems.vscode-axe-linter&ssr=false#overview
exclude:
test/**/*
exclude: test/**/*
4 changes: 2 additions & 2 deletions build/build-manual.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ module.exports = function build(grunt, options, commons, callback) {

function parseObject(src) {
var files = grunt.file.expand(src);
return files.map(function(file) {
return files.map(function (file) {
var json = grunt.file.readJSON(file);
var dirname = path.dirname(file);
Object.keys(templates).forEach(function(templateName) {
Object.keys(templates).forEach(function (templateName) {
if (json[templateName] && json[templateName].endsWith('.js')) {
json[templateName] = path.resolve(dirname, json[templateName]);
if (options.getFiles) {
Expand Down
27 changes: 10 additions & 17 deletions build/cherry-pick.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ if (ignoreCommits) {
}

// don't run on master or develop branch
const currentBranch = execSync('git branch --show-current')
.toString()
.trim();
const currentBranch = execSync('git branch --show-current').toString().trim();
if (['develop', 'master'].includes(currentBranch)) {
console.error(
`Please run the script on a release branch and not the ${currentBranch} branch`
Expand Down Expand Up @@ -60,20 +58,15 @@ function getCommits(branch) {
const hash = commit.substring(0, 8);
const msg = commit.substring(commit.indexOf('\n\n')).trim();

const {
type,
scope,
subject,
merge,
notes
} = conventionalCommitsParser.sync(msg, {
// parse merge commits
mergePattern: /^Merge pull request #(\d+) from (.*)$/,
mergeCorrespondence: ['id', 'source'],

// allow comma in scope
headerPattern: /^(\w*)(?:\(([\w\$\.\-\*, ]*)\))?\: (.*)$/
});
const { type, scope, subject, merge, notes } =
conventionalCommitsParser.sync(msg, {
// parse merge commits
mergePattern: /^Merge pull request #(\d+) from (.*)$/,
mergeCorrespondence: ['id', 'source'],

// allow comma in scope
headerPattern: /^(\w*)(?:\(([\w\$\.\-\*, ]*)\))?\: (.*)$/
});

const isBreakingChange = notes.some(
note => note.title === 'BREAKING CHANGE'
Expand Down
12 changes: 5 additions & 7 deletions build/rule-generator/get-answers.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ const getAnswers = async () => {
}

// answers if TEST files to be created
const {
getIsUnitTestAssets,
getIsIntegrationTestAssets
} = await inquirer.prompt([
questions.getIsUnitTestAssets,
questions.getIsIntegrationTestAssets
]);
const { getIsUnitTestAssets, getIsIntegrationTestAssets } =
await inquirer.prompt([
questions.getIsUnitTestAssets,
questions.getIsIntegrationTestAssets
]);

return {
ruleName: getRuleName.toLowerCase(),
Expand Down
6 changes: 1 addition & 5 deletions build/rule-generator/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ const validateGetCheckName = async input => {
});
// cannot use `fs.existsSync` here, as we do not know which category of checks to look under
const axeChecksFileNames = checkSpecs.map(
f =>
f
.replace('.json', '')
.split('/')
.reverse()[0]
f => f.replace('.json', '').split('/').reverse()[0]
);
if (axeChecksFileNames.includes(checkName)) {
throw new Error('CHECK name conflicts with an existing filename.');
Expand Down
18 changes: 9 additions & 9 deletions build/tasks/add-locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
var clone = require('clone');
var buildManual = require('../build-manual');

module.exports = function(grunt) {
module.exports = function (grunt) {
function mergeMessages(newMessages, oldMessages) {
Object.keys(newMessages).forEach(function(key) {
Object.keys(newMessages).forEach(function (key) {
if (!oldMessages.hasOwnProperty(key)) {
return;
}
Expand All @@ -31,7 +31,7 @@ module.exports = function(grunt) {
grunt.registerMultiTask(
'add-locale',
'Task for localizing messages in rules and checks',
function() {
function () {
var options = this.options({
rules: ['lib/rules/**/*.json'],
checks: ['lib/checks/**/*.json'],
Expand All @@ -41,27 +41,27 @@ module.exports = function(grunt) {
lang: 'xxx'
});

this.files.forEach(function(file) {
this.files.forEach(function (file) {
var commons = file.src[0];

buildManual(grunt, options, commons, function(result) {
buildManual(grunt, options, commons, function (result) {
var out = {
lang: options.lang,
rules: result.rules.reduce(function(out, rule) {
rules: result.rules.reduce(function (out, rule) {
out[rule.id] = rule.metadata;
return out;
}, {}),
checks: result.checks.reduce(function(out, check) {
checks: result.checks.reduce(function (out, check) {
if (check.metadata) {
out[check.id] = check.metadata.messages;
}
return out;
}, {}),
failureSummaries: result.misc.reduce(function(out, misc) {
failureSummaries: result.misc.reduce(function (out, misc) {
out[misc.type] = misc.metadata;
return out;
}, {}),
incompleteFallbackMessage: result.misc.reduce(function(out, misc) {
incompleteFallbackMessage: result.misc.reduce(function (out, misc) {
return misc.incompleteFallbackMessage
? misc.incompleteFallbackMessage
: out;
Expand Down
4 changes: 2 additions & 2 deletions build/tasks/aria-supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const { roles, aria: props } = require('aria-query');
const mdTable = require('markdown-table');
const format = require('../shared/format');

module.exports = function(grunt) {
module.exports = function (grunt) {
grunt.registerMultiTask(
'aria-supported',
'Task for generating a diff of supported aria roles and properties.',
function() {
function () {
/**
* NOTE:
* `axe` has to be dynamically required at this stage,
Expand Down
8 changes: 4 additions & 4 deletions build/tasks/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
var buildRules = require('../configure');
var format = require('../shared/format');

module.exports = function(grunt) {
module.exports = function (grunt) {
grunt.registerMultiTask(
'configure',
'Task for configuring rules and checks',
function() {
function () {
var done = this.async();
var options = this.options({
rules: ['lib/rules/**/*.json'],
Expand All @@ -17,13 +17,13 @@ module.exports = function(grunt) {
tags: ''
});

this.files.forEach(function(file) {
this.files.forEach(function (file) {
var match = file.dest.auto.match(/\.([a-z]{2,3})\.js/);
if (match) {
options.locale = match[1];
}

buildRules(grunt, options, null, function(result) {
buildRules(grunt, options, null, function (result) {
grunt.file.write(file.dest.auto, 'axe._load(' + result.auto + ');');

// Format the content so Prettier doesn't create a diff after running.
Expand Down
4 changes: 2 additions & 2 deletions build/tasks/esbuild.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const { build } = require('esbuild');
const path = require('path');

module.exports = function(grunt) {
module.exports = function (grunt) {
grunt.registerMultiTask(
'esbuild',
'Task to run the esbuild javascript bundler',
function() {
function () {
const done = this.async();
const files = grunt.task.current.data.files;

Expand Down
20 changes: 10 additions & 10 deletions build/tasks/langs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*eslint-env node */
'use strict';
var http = require('http');
module.exports = function(grunt) {
module.exports = function (grunt) {
function getLine(data, start) {
var len = data.length;
var index = start;
Expand Down Expand Up @@ -56,7 +56,7 @@ module.exports = function(grunt) {
grunt.registerMultiTask(
'langs',
'Task for generating commons language codes from IANA registry',
function() {
function () {
var done = this.async();
var ianaLangsURL =
'http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry';
Expand All @@ -66,24 +66,24 @@ module.exports = function(grunt) {
}
var check = this.data.check;
var langs = [];
new Promise(function(resolve, reject) {
new Promise(function (resolve, reject) {
var data = '';
http
.get(ianaLangsURL, function(res) {
.get(ianaLangsURL, function (res) {
res
.on('data', function(chunk) {
.on('data', function (chunk) {
data += chunk;
})
.on('end', function() {
.on('end', function () {
resolve(data);
});
})
.on('error', function(e) {
.on('error', function (e) {
grunt.log.error('Got error: ' + e.message);
reject(false);
});
})
.then(function(data) {
.then(function (data) {
var entry = getEntry(data, 0);
var pos = entry.used;
while (true) {
Expand All @@ -100,10 +100,10 @@ module.exports = function(grunt) {
}
generateOutput(langs, check);
})
.then(function() {
.then(function () {
done();
})
.catch(function(result) {
.catch(function (result) {
done(result);
});
}
Expand Down
4 changes: 2 additions & 2 deletions build/tasks/metadata-function-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ function toTitleCase(str) {
});
}

module.exports = function(grunt) {
module.exports = function (grunt) {
grunt.registerMultiTask(
'metadata-function-map',
'Task to generate the metadata-function-map file',
function() {
function () {
const files = grunt.task.current.data.files;

files.forEach(file => {
Expand Down
4 changes: 2 additions & 2 deletions build/tasks/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ const { notify } = require('node-notifier');
/*eslint-env node */
('use strict');

module.exports = function(grunt) {
module.exports = function (grunt) {
grunt.registerMultiTask(
'notify',
'This task sends an OS notification when a task has completed',
function() {
function () {
notify(this.data);
}
);
Expand Down
4 changes: 2 additions & 2 deletions build/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const chalk = require('chalk');
/*eslint-env node */
('use strict');

module.exports = function(grunt) {
module.exports = function (grunt) {
grunt.registerMultiTask(
'test',
'This task runs unit tests based on which file was changed',
function() {
function () {
const testFile = this.data.testFile;
console.log(`${chalk.green('>>')} File "${testFile}"`);

Expand Down
Loading

0 comments on commit dfc5643

Please sign in to comment.