Skip to content

update eslint #1412

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

Merged
merged 9 commits into from
Jun 29, 2024
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 0 additions & 45 deletions .eslintrc.json

This file was deleted.

12 changes: 6 additions & 6 deletions .github/bin/format-package-json.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ const formatted = {};

formatted.funding = [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
'type': 'github',
'url': 'https://github.com/sponsors/csstools',
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
'type': 'opencollective',
'url': 'https://opencollective.com/csstools',
},
];

delete packageJSONInfo.funding;
Expand All @@ -75,7 +75,7 @@ const formatted = {};
delete packageJSONInfo.private;

formatted.engines = {
node: '^14 || ^16 || >=18'
node: '^14 || ^16 || >=18',
};
delete packageJSONInfo.engines;

Expand Down
6 changes: 3 additions & 3 deletions .github/bin/generate-docs/api-documenter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ await new Promise((resolve, reject) => {
],
{
stdio: 'inherit',
shell: platform === 'win32'
}
shell: platform === 'win32',
},
);

publishCmd.on('close', (code) => {
Expand All @@ -49,6 +49,6 @@ await new Promise((resolve, reject) => {

for (const file of await getFiles('docs', true)) {
const fileContents = fs.readFileSync(file, 'utf8').toString();
const cleanFileContents = fileContents.replace(/\r\n/g, "\n");
const cleanFileContents = fileContents.replace(/\r\n/g, '\n');
fs.writeFileSync(file, cleanFileContents);
}
6 changes: 3 additions & 3 deletions .github/bin/generate-docs/install.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ installDoc = installDoc.replaceAll('<packagePath>', path.join(path.basename(path

if (packageJSONInfo?.csstools?.assumesToProcessBundledCSS) {
installDoc = installDoc.replaceAll('<parallelBuildsNotice>', parallelBuildsNotice(packageJSONInfo.csstools.humanReadableName));
installDoc = installDoc.replaceAll('<otherPluginsInWebpack>', `["@csstools/postcss-bundler"]`);
installDoc = installDoc.replaceAll('<otherPluginsInWebpack>', '["@csstools/postcss-bundler"]');
// <parallelBuildsNotice>
} else {
// Just a filler so that formatting doesn't become too complex.
installDoc = installDoc.replaceAll('<parallelBuildsNotice>', ``);
installDoc = installDoc.replaceAll('<otherPluginsInWebpack>', `// Other plugins`);
installDoc = installDoc.replaceAll('<parallelBuildsNotice>', '');
installDoc = installDoc.replaceAll('<otherPluginsInWebpack>', '// Other plugins');
}

fs.writeFileSync('./INSTALL.md', installDoc);
8 changes: 4 additions & 4 deletions .github/bin/generate-docs/readme.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ let exampleFilePaths = [];
try {
exampleFilePaths = (
await fs.promises.readdir(path.join('test', 'examples'), { recursive: true, withFileTypes: true })
).filter(x => x.isFile()).map(x => path.join(x.path, x.name));
} catch(error) {
).filter(x => x.isFile()).map(x => path.join(x.parentPath, x.name));
} catch {
// No examples
}

Expand Down Expand Up @@ -60,7 +60,7 @@ readmeDoc = readmeDoc.replace('<header>', `# <humanReadableName> [<img src="http
`\n
\`\`\`bash
npm install <packageName> --save-dev
\`\`\``
\`\`\``,
);

// Insert "Usage" section
Expand Down Expand Up @@ -119,7 +119,7 @@ readmeDoc = readmeDoc.replaceAll('<specUrl>', packageJSONInfo.csstools.specUrl);
if (packageJSONInfo?.csstools?.assumesToProcessBundledCSS) {
readmeDoc = readmeDoc.replaceAll('<parallelBuildsNotice>', parallelBuildsNotice(packageJSONInfo.csstools.humanReadableName));
} else {
readmeDoc = readmeDoc.replaceAll('<parallelBuildsNotice>', ``);
readmeDoc = readmeDoc.replaceAll('<parallelBuildsNotice>', '');
}

for (const exampleFilePath of exampleFilePaths) {
Expand Down
2 changes: 1 addition & 1 deletion .github/bin/license/allowed.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const osiApproved = [
'BSL-1.0',
'Artistic-1.0-Perl',
'NPOSL-3.0',
'BlueOak-1.0.0' // https://github.com/spdx/license-list-XML/commit/d2709ad9c8c3f92989d2e7cadba3af8d1e0bc166
'BlueOak-1.0.0', // https://github.com/spdx/license-list-XML/commit/d2709ad9c8c3f92989d2e7cadba3af8d1e0bc166
];

export const osiApprovedWithCCO = [
Expand Down
4 changes: 2 additions & 2 deletions .github/bin/list-workspaces/list-workspaces.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export async function listWorkspaces() {
const packageDirs = await getFiles(workspace.slice(0, -2), false);
for (const packageDir of packageDirs) {
packages.add(
path.resolve(path.join(packageDir, 'package.json'))
path.resolve(path.join(packageDir, 'package.json')),
);
}
} else {
packages.add(
path.resolve(path.join(workspace, 'package.json'))
path.resolve(path.join(workspace, 'package.json')),
);
}
}
Expand Down
12 changes: 6 additions & 6 deletions .github/bin/modified-workspaces/list-modified-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function listModifiedFilesInPullRequest(repository, pullRequestNumb
while (true) {
const newFiles = await getPullRequestFiles(repository, pullRequestNumber, page);
allFiles.push(...newFiles);
page++
page++;

if (newFiles.length < 100) {
break;
Expand All @@ -21,8 +21,8 @@ export async function listModifiedFilesInPullRequest(repository, pullRequestNumb
async function getPullRequestFiles(repository, pullRequestNumber, page) {
return await (new Promise((resolve, reject) => {
const headers = {
'User-Agent': 'GitHub Workflow'
}
'User-Agent': 'GitHub Workflow',
};

if (process.env.GITHUB_TOKEN) {
headers['authorization'] = `Bearer ${process.env.GITHUB_TOKEN}`;
Expand All @@ -33,10 +33,10 @@ async function getPullRequestFiles(repository, pullRequestNumber, page) {
port: 443,
path: `/repos/${repository}/pulls/${pullRequestNumber}/files?per_page=100&page=${page}`,
method: 'GET',
headers: headers
headers: headers,
}, (res) => {
if (!res.statusCode || (Math.floor(res.statusCode / 100) !== 2)) {
throw new Error(`Unexpected response code "${res.statusCode}" with message "${res.statusMessage}"`)
throw new Error(`Unexpected response code "${res.statusCode}" with message "${res.statusMessage}"`);
}

let data = [];
Expand All @@ -46,7 +46,7 @@ async function getPullRequestFiles(repository, pullRequestNumber, page) {

res.on('end', () => {
resolve(
JSON.parse(Buffer.concat(data).toString()).map((x) => x.filename)
JSON.parse(Buffer.concat(data).toString()).map((x) => x.filename),
);
});

Expand Down
10 changes: 5 additions & 5 deletions .github/bin/release-plan/commit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export async function commitSingleDirectory(commitMessage, dir) {
[
'commit',
'-am',
commitMessage
commitMessage,
],
{
cwd: dir
}
cwd: dir,
},
);

let stdoutBuffer = '';
Expand Down Expand Up @@ -60,8 +60,8 @@ export async function commitAfterDependencyUpdates() {
[
'commit',
'-am',
`set dependencies to newly released versions`
]
'set dependencies to newly released versions',
],
);

let stdoutBuffer = '';
Expand Down
12 changes: 6 additions & 6 deletions .github/bin/release-plan/discord-announce.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const defaultPayload = {
url: '',
description: '',
color: 3963146,
}
]
},
],
};
const BASE_URL = 'https://github.com/csstools/postcss-plugins/tree/main';
const getChangelog = (changelog) => {
Expand All @@ -19,8 +19,8 @@ const getChangelog = (changelog) => {
const text = changelog.slice(firstLineBreakIndex + 1, secondRelease === -1 ? undefined : secondRelease).trim();

// Replace relative links with absolute links
return text.replace( /]\(\//g, `](${ BASE_URL }/` );
}
return text.replace(/]\(\//g, `](${ BASE_URL }/`);
};

export async function discordAnnounce(workspace) {
if (process.env.DEBUG) {
Expand Down Expand Up @@ -65,14 +65,14 @@ export async function discordAnnounceDryRun() {

const discordArgument = process.argv.slice(2).find(arg => arg.includes('--discord='));
if (!discordArgument) {
console.log(`Discord announce webhook URL: not set`);
console.log('Discord announce webhook URL: not set');
return;
}

const [, webHookUrl] = discordArgument.split('=');

if (!webHookUrl) {
console.log(`Discord announce webhook URL: not set`);
console.log('Discord announce webhook URL: not set');
return;
}

Expand Down
6 changes: 3 additions & 3 deletions .github/bin/release-plan/docs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export async function updateDocumentation(packageDirectory) {
[
'run',
'docs',
'--if-present'
'--if-present',
],
{
cwd: packageDirectory,
shell: platform === 'win32'
}
shell: platform === 'win32',
},
);

let stdoutBuffer = '';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs/promises'
import path from 'path'
import fs from 'fs/promises';
import path from 'path';

export async function minifyChangelogAndPackageJSON(workspace) {
const originalPackageInfo = JSON.parse(await fs.readFile(path.join(workspace.path, 'package.json')));
Expand Down Expand Up @@ -49,5 +49,5 @@ export async function minifyChangelogAndPackageJSON(workspace) {
return async () => {
await fs.writeFile(path.join(workspace.path, 'package.json'), JSON.stringify(originalPackageInfo, null, '\t') + '\n');
await fs.writeFile(path.join(workspace.path, 'CHANGELOG.md'), originalChangelog);
}
};
}
8 changes: 4 additions & 4 deletions .github/bin/release-plan/npm-can-publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export async function canPublish(packageName, myName) {
'list',
'collaborators',
packageName,
myName
myName,
],
{
shell: platform === 'win32',
stdio: 'pipe'
}
stdio: 'pipe',
},
);

let result = '';
Expand Down Expand Up @@ -43,7 +43,7 @@ export async function canPublish(packageName, myName) {

resolve(
result.trim().includes(myName) &&
result.trim().includes('read-write')
result.trim().includes('read-write'),
);
});
});
Expand Down
6 changes: 3 additions & 3 deletions .github/bin/release-plan/npm-install.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export async function npmInstall() {
const installCmd = spawn(
'npm',
[
'install'
'install',
],
{
shell: platform === 'win32'
}
shell: platform === 'win32',
},
);

installCmd.on('close', (code) => {
Expand Down
6 changes: 3 additions & 3 deletions .github/bin/release-plan/npm-prepublish-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export async function npmPrepublishScripts(packageDirectory, packageName) {
[
'run',
'prepublishOnly',
'--if-present'
'--if-present',
],
{
stdio: 'inherit',
cwd: packageDirectory,
shell: platform === 'win32'
}
shell: platform === 'win32',
},
);

publishCmd.on('close', (code) => {
Expand Down
6 changes: 3 additions & 3 deletions .github/bin/release-plan/npm-publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export async function npmPublish(packageDirectory, packageName) {
[
'publish',
'--access',
'public'
'public',
],
{
stdio: 'inherit',
cwd: packageDirectory,
shell: platform === 'win32'
}
shell: platform === 'win32',
},
);

publishCmd.on('close', (code) => {
Expand Down
6 changes: 3 additions & 3 deletions .github/bin/release-plan/npm-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export async function npmVersion(increment, packageDirectory) {
'npm',
[
'version',
increment
increment,
],
{
cwd: packageDirectory,
shell: platform === 'win32'
}
shell: platform === 'win32',
},
);

let stdoutBuffer = '';
Expand Down
Loading