Skip to content

Commit

Permalink
chore: update eslint & remove prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Nov 17, 2024
1 parent d29185b commit 754f05a
Show file tree
Hide file tree
Showing 204 changed files with 1,137 additions and 1,100 deletions.
27 changes: 0 additions & 27 deletions .eslintrc.js

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

15 changes: 0 additions & 15 deletions .prettierrc.json

This file was deleted.

18 changes: 9 additions & 9 deletions build/deploy-netlify.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ async function listFilesWithHashes(dir, exclude, hashfn) {
results: [],
});

files.forEach(file => {
queue.push(cb => {
files.forEach((file) => {
queue.push((cb) => {
const input = createReadStream(file);

const hash = createHash(hashfn);
Expand Down Expand Up @@ -126,7 +126,6 @@ async function createDeploy(files, functions) {
console.log(`Created deploy #${deploy.id} (${deploy.deploy_ssl_url}). ${deploy.required.length} new files.`);

return deploy;

} catch {
console.error('Cannot create deploy');
process.exit(1);
Expand All @@ -141,7 +140,7 @@ async function publishDeploy(deploy) {
await retryFetch(`https://api.netlify.com/api/v1/sites/${process.env.NETLIFY_SITE_ID}/deploys/${deploy.id}/restore`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.NETLIFY_AUTH_TOKEN,
Authorization: 'Bearer ' + process.env.NETLIFY_AUTH_TOKEN,
},
});

Expand All @@ -159,7 +158,7 @@ async function cancelDeploy(deploy) {
await retryFetch(`https://api.netlify.com/api/v1/deploys/${deploy.id}/cancel`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.NETLIFY_AUTH_TOKEN,
Authorization: 'Bearer ' + process.env.NETLIFY_AUTH_TOKEN,
},
});

Expand All @@ -185,8 +184,8 @@ async function uploadFiles(dir, files, deploy) {
results: [],
});

deploy.required.forEach(hash => {
queue.push(cb => {
deploy.required.forEach((hash) => {
queue.push((cb) => {
const file = fileByHash[hash];

console.log(`Upload ${file}`);
Expand Down Expand Up @@ -221,6 +220,7 @@ async function uploadFiles(dir, files, deploy) {
/**
* Upload new functions to Netlify
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function uploadFunctions(dir, functions, deploy) {
if (!deploy.required_functions.length) {
return;
Expand All @@ -234,8 +234,8 @@ async function uploadFunctions(dir, functions, deploy) {
results: [],
});

deploy.required_functions.forEach(hash => {
queue.push(cb => {
deploy.required_functions.forEach((hash) => {
queue.push((cb) => {
const fctn = functionsByHash[hash];

fetch(`https://api.netlify.com/api/v1/deploys/${deploy.id}/functions/${fctn.replace('.zip', '')}`, {
Expand Down
6 changes: 3 additions & 3 deletions build/generate-changelog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ stdin.on('end', () => {
${log
.trim()
.split('\n')
.map((line) => line.trim())
.filter((line) => !line.startsWith('chore') && !line.startsWith('doc'))
.map((line) => `- ${line}`)
.map(line => line.trim())
.filter(line => !line.startsWith('chore') && !line.startsWith('doc'))
.map(line => `- ${line}`)
.join('\n')}`;

process.stdout.write(content);
Expand Down
4 changes: 2 additions & 2 deletions build/generate-coverage-summary.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ script.runInContext(context);
const values = Object.values(context.window.COVERAGE_DATA)
.reduce((result, { metrics, path }) => {
const module = path.split('/').shift();
[TOTAL, module].forEach(key => {
[TOTAL, module].forEach((key) => {
const moduleMetrics = result[key] ?? {
branches: { total: 0, covered: 0 },
functions: { total: 0, covered: 0 },
Expand Down Expand Up @@ -51,7 +51,7 @@ ${Object.entries(values)
return `| **${name}** | ${entry(lines)} | ${entry(functions)} | ${entry(branches)} |`;
})
.join('\n')
}
}
`;

process.stdout.write(summary);
8 changes: 4 additions & 4 deletions build/generate-typedoc-readme.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ const DIST_DIR = '.tmp/typedoc';
const DIST_FILE = 'README.md';

(async () => {
const packages = readdirSync(PACKAGES_DIR).filter((name) => name !== 'shared');
const packages = readdirSync(PACKAGES_DIR).filter(name => name !== 'shared');

const plugins = [];
const adapters = [];

for (let name of packages) {
for (const name of packages) {
const pkgFile = path.join(PACKAGES_DIR, name, PKG_FILE);
const typedocFile = path.join(PACKAGES_DIR, name, TYPEDOC_FILE);
const distDir = path.join(PACKAGES_DIR, name, DIST_DIR);
Expand Down Expand Up @@ -56,11 +56,11 @@ Documentation : ${pkg.homepage}
# Plugins
${plugins.map((plugin) => `- [${plugin}](modules/${plugin}.html)`).join('\n')}
${plugins.map(plugin => `- [${plugin}](modules/${plugin}.html)`).join('\n')}
# Adapters
${adapters.map((adapter) => `- [${adapter}](modules/${adapter}.html)`).join('\n')}
${adapters.map(adapter => `- [${adapter}](modules/${adapter}.html)`).join('\n')}
`.trim();

console.log(`create ${destFile}`);
Expand Down
6 changes: 3 additions & 3 deletions build/liveserver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CYPRESS_DIR = 'cypress/pages';
const PACKAGES_DIR = 'packages';
const DIST_DIR = 'dist';

const packages = fs.readdirSync(path.join(rootDir, PACKAGES_DIR)).filter((name) => name !== 'shared');
const packages = fs.readdirSync(path.join(rootDir, PACKAGES_DIR)).filter(name => name !== 'shared');
const fakeCert = getFakeCert();
const e2e = process.argv[2] === '--e2e';

Expand All @@ -33,12 +33,12 @@ liveServer.start({
watch: [
path.join(rootDir, EXAMPLES_DIR),
path.join(rootDir, CYPRESS_DIR),
...packages.map((name) => path.join(rootDir, PACKAGES_DIR, name, DIST_DIR)),
...packages.map(name => path.join(rootDir, PACKAGES_DIR, name, DIST_DIR)),
],
mount: [
['/node_modules', path.join(rootDir, 'node_modules')],
['/e2e', path.join(CYPRESS_DIR)],
...packages.map((name) => [`/dist/${name}`, path.join(rootDir, PACKAGES_DIR, name, DIST_DIR)]),
...packages.map(name => [`/dist/${name}`, path.join(rootDir, PACKAGES_DIR, name, DIST_DIR)]),
],
https: {
cert: fakeCert,
Expand Down
4 changes: 2 additions & 2 deletions build/plugins/esbuild-plugin-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export function assetsPlugin(files: Record<string, string | Promise<string>>): P
console.log('ASSET', outpath, prettyBytes(content.length));
return writeFile(outpath, content);
});
})
)
}),
),
)
.then(() => undefined);
});
Expand Down
2 changes: 1 addition & 1 deletion build/plugins/esbuild-plugin-budget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function budgetPlugin(budget: string): Plugin {
setup(build) {
build.onEnd((result) => {
['index.cjs', 'index.module.js'].forEach((filename) => {
const file = result.outputFiles.find((f) => f.path.endsWith(filename));
const file = result.outputFiles.find(f => f.path.endsWith(filename));
if (file) {
if (file.contents.length > maxsize) {
const size = Math.round(file.contents.length / 1024);
Expand Down
2 changes: 1 addition & 1 deletion build/plugins/esbuild-plugin-map-fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function mapFixPlugin(): Plugin {
setup(build) {
build.onEnd((result) => {
['index.css.map', 'index.cjs.map', 'index.module.js.map'].forEach((filename) => {
const mapFile = result.outputFiles.find((f) => f.path.endsWith(filename));
const mapFile = result.outputFiles.find(f => f.path.endsWith(filename));
if (!mapFile) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion build/plugins/esbuild-plugin-scss-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function scssBundlePlugin(): Plugin {
const outpath = outdir + '/index.scss';

build.onEnd((result) => {
const scssFile = Object.keys(result.metafile.inputs).find((file) => file.endsWith('.scss'));
const scssFile = Object.keys(result.metafile.inputs).find(file => file.endsWith('.scss'));
if (!scssFile) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions build/prepare-package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DIST_DIR = 'dist';
const LICENSE_FILE = 'LICENSE';

fs.readdirSync(PACKAGES_DIR)
.filter((name) => name !== 'shared')
.filter(name => name !== 'shared')
.forEach((name) => {
const source = path.join(PACKAGES_DIR, name, DIST_DIR);
const destination = path.join(DIST_DIR, name);
Expand All @@ -20,7 +20,7 @@ fs.readdirSync(PACKAGES_DIR)

fs.copySync(source, destination, {
filter(name) {
return name === source || ['js', 'css', 'scss', 'ts', 'map', 'json'].some((ext) => name.endsWith(ext));
return name === source || ['js', 'css', 'scss', 'ts', 'map', 'json'].some(ext => name.endsWith(ext));
},
});
});
Expand Down
4 changes: 2 additions & 2 deletions build/select-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import fs from 'fs';
import process from 'process';

const PACKAGES_DIR = 'packages';
const packages = fs.readdirSync(PACKAGES_DIR).filter((name) => name !== 'shared' && name !== 'core');
const packages = fs.readdirSync(PACKAGES_DIR).filter(name => name !== 'shared' && name !== 'core');

const prompt = new enquirer.MultiSelect({
name: 'packages',
Expand All @@ -19,7 +19,7 @@ const prompt = new enquirer.MultiSelect({

prompt.run()
.then((answers) => {
const filters = answers.map((p) => `--filter=@photo-sphere-viewer/${p}`).join(' ');
const filters = answers.map(p => `--filter=@photo-sphere-viewer/${p}`).join(' ');
process.stdout.write(`--filter=// --filter=@photo-sphere-viewer/core ${filters}`);
})
.catch(() => {
Expand Down
2 changes: 1 addition & 1 deletion build/templates/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const packageJson = (pkg: any) => {
url: 'git://github.com/mistic100/Photo-Sphere-Viewer.git',
},
author: {
name: "Damien 'Mistic' Sorel",
name: `Damien 'Mistic' Sorel`,
email: '[email protected]',
homepage: 'https://www.strangeplanet.fr',
},
Expand Down
Loading

0 comments on commit 754f05a

Please sign in to comment.