Skip to content

Commit

Permalink
style: run prettier from monorepo root
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan committed Jan 18, 2025
1 parent 4e7dc05 commit 2a03f1c
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 49 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/issue-notifications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- name : "Assign for verification"
- name: "Assign for verification"
if: github.event.label.name == '3 - installed'
uses: actions/github-script@v7
env:
Expand Down Expand Up @@ -50,4 +50,3 @@ jobs:
script: |
const action = require('${{ github.workspace }}/.github/scripts/notifyAboutNewComponent.js')
await action({github, context, core})
6 changes: 4 additions & 2 deletions packages/calcite-components-react/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export default [{
export default [
{
ignores: ["**/*"],
}];
},
];
2 changes: 1 addition & 1 deletion packages/calcite-components/src/01-introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from '@storybook/blocks';
import { Meta } from "@storybook/blocks";

<Meta title="Overview/Home" />

Expand Down
4 changes: 2 additions & 2 deletions packages/calcite-components/src/02-contributing.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Markdown, Meta } from '@storybook/blocks';
import CONTRIBUTING from '../../../CONTRIBUTING.md?raw';
import { Markdown, Meta } from "@storybook/blocks";
import CONTRIBUTING from "../../../CONTRIBUTING.md?raw";

<Meta title="Overview/Contributing" />

Expand Down
4 changes: 2 additions & 2 deletions packages/calcite-components/src/03-code-of-conduct.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Markdown, Meta } from '@storybook/blocks';
import CODE_OF_CONDUCT from '../../../CODE_OF_CONDUCT.md?raw';
import { Markdown, Meta } from "@storybook/blocks";
import CODE_OF_CONDUCT from "../../../CODE_OF_CONDUCT.md?raw";

<Meta title="Overview/Code of Conduct" />

Expand Down
4 changes: 2 additions & 2 deletions packages/calcite-components/src/04-licensing.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Markdown, Meta } from '@storybook/blocks';
import { Markdown, Meta } from "@storybook/blocks";

<Meta title="Overview/Licensing" />

import LICENSE from '../LICENSE.md';
import LICENSE from "../LICENSE.md";

<Markdown>{LICENSE}</Markdown>
4 changes: 2 additions & 2 deletions packages/calcite-components/src/06-faq.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Markdown, Meta } from '@storybook/blocks';
import { Markdown, Meta } from "@storybook/blocks";

<Meta title="Overview/FAQ" />

import FAQ from '../FAQ.md';
import FAQ from "../FAQ.md";

<Markdown>{FAQ}</Markdown>
4 changes: 2 additions & 2 deletions packages/calcite-components/src/07-conventions.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Markdown, Meta } from '@storybook/blocks';
import { Markdown, Meta } from "@storybook/blocks";

<Meta title="Overview/Conventions" />

import CONVENTIONS from '../conventions/README.md';
import CONVENTIONS from "../conventions/README.md";

<Markdown>{CONVENTIONS}</Markdown>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Markdown, Meta} from "@storybook/blocks";
import { Markdown, Meta } from "@storybook/blocks";
import CONVENTIONS from "../conventions/Internationalization.md?raw";

<Meta title="Overview/Internationalization" />
Expand Down
48 changes: 23 additions & 25 deletions packages/calcite-ui-icons/bin/build-fonts.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/usr/bin/env node
const { execSync } = require('child_process');
const { execSync } = require("child_process");
const {
readdirSync,
mkdirSync,
rmSync,
existsSync,
lstatSync,
symlinkSync,
unlinkSync,
readFileSync,
writeFileSync,
} = require('fs');
const { join, basename } = require('path');
const prettier = require('@prettier/sync');
readdirSync,
mkdirSync,
rmSync,
existsSync,
lstatSync,
symlinkSync,
unlinkSync,
readFileSync,
writeFileSync,
} = require("fs");
const { join, basename } = require("path");
const prettier = require("@prettier/sync");

const SCRIPT_DIR = __dirname;
const PACKAGE_ROOT = join(SCRIPT_DIR, '..');
const fontsDir = join(PACKAGE_ROOT, 'fonts/icons');
const iconsDir = join(PACKAGE_ROOT, 'icons');
const PACKAGE_ROOT = join(SCRIPT_DIR, "..");
const fontsDir = join(PACKAGE_ROOT, "fonts/icons");
const iconsDir = join(PACKAGE_ROOT, "icons");

const sizes = [16, 24, 32];
const ensureDir = (dir) => mkdirSync(dir, { recursive: true });
Expand All @@ -31,7 +31,7 @@ const clearAndPrepareDirs = () => {
const filterIcons = () =>
readdirSync(iconsDir).filter((file) => {
const filePath = join(iconsDir, file);
return file.endsWith('.svg') && !readFileSync(filePath, 'utf8').includes('opacity');
return file.endsWith(".svg") && !readFileSync(filePath, "utf8").includes("opacity");
});

const createLinks = (icons) => {
Expand All @@ -47,7 +47,7 @@ const organizeIconsBySize = (size) => {
readdirSync(fontsDir).forEach((file) => {
if (file.includes(`-${size}`)) {
const src = join(fontsDir, file);
const dest = join(sizeDir, file.replace(`-${size}`, ''));
const dest = join(sizeDir, file.replace(`-${size}`, ""));
if (lstatSync(src).isSymbolicLink()) {
if (existsSync(dest)) unlinkSync(dest);
symlinkSync(src, dest);
Expand All @@ -58,21 +58,19 @@ const organizeIconsBySize = (size) => {

const generateFonts = (size) =>
execSync(`fantasticon fonts/icons/${size}/ -n calcite-ui-icons-${size} --normalize true -t ttf -g json -o fonts/`, {
stdio: 'inherit',
stdio: "inherit",
});

const updateConfig = () => {
const codepoints = JSON.parse(readFileSync(join(PACKAGE_ROOT, 'fonts/calcite-ui-icons-16.json'), 'utf8'));
const config = prettier.format(JSON.stringify({ codepoints }), { parser: 'json' });
writeFileSync(join(PACKAGE_ROOT, 'fantasticonrc.json'), config);
const codepoints = JSON.parse(readFileSync(join(PACKAGE_ROOT, "fonts/calcite-ui-icons-16.json"), "utf8"));
const config = prettier.format(JSON.stringify({ codepoints }), { parser: "json" });
writeFileSync(join(PACKAGE_ROOT, "fantasticonrc.json"), config);
};

const main = () => {
module.exports = () => {
clearAndPrepareDirs();
createLinks(filterIcons());
sizes.forEach(organizeIconsBySize);
sizes.forEach(generateFonts);
updateConfig();
};

main();
12 changes: 9 additions & 3 deletions packages/calcite-ui-icons/docs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@
var filled = key.substring(key.length - 2);
var isFilled = filled === "-f";
var baseName = isFilled ? key.substring(0, key.length - 2) : key;
var baseURL = "https://raw.githubusercontent.com/Esri/calcite-ui-icons/master/icons/" + encodeURIComponent(baseName) + "-";
var baseURL =
"https://raw.githubusercontent.com/Esri/calcite-ui-icons/master/icons/" + encodeURIComponent(baseName) + "-";
var suffix = ".svg";
var tags = icon.alias
.map(function (alias) {
return '<span class="label inline-block margin-right-quarter trailer-quarter">' + encodeURIComponent(alias) + "</span>";
return (
'<span class="label inline-block margin-right-quarter trailer-quarter">' +
encodeURIComponent(alias) +
"</span>"
);
})
.join("");

Expand All @@ -84,7 +89,8 @@
document.querySelector(".js-detail-release").textContent = (icon.release && icon.release) || "---";

[16, 24, 32].forEach(function (size) {
document.querySelector(".js-link-" + size).href = baseURL + size + (isFilled ? encodeURIComponent(filled) : "") + suffix;
document.querySelector(".js-link-" + size).href =
baseURL + size + (isFilled ? encodeURIComponent(filled) : "") + suffix;
var iconDetail = document.querySelector(".js-detail-" + size);
iconDetail.innerHTML = "";
iconDetail.appendChild(getSVG(icon[size], size));
Expand Down
1 change: 0 additions & 1 deletion packages/eslint-config-calcite/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default tseslint.config(
},
],


"import/no-dynamic-require": [
"error",
{
Expand Down
1 change: 0 additions & 1 deletion packages/eslint-config-calcite/jsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ export default tseslint.config({
],
},
});

6 changes: 4 additions & 2 deletions packages/eslint-plugin-calcite-components/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export default [{
export default [
{
ignores: ["**/*"],
}];
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ RuleTester.afterAll = afterAll;
RuleTester.describe = describe;
RuleTester.it = it;


export const ruleTester = () =>
new RuleTester({
languageOptions: {
Expand Down

0 comments on commit 2a03f1c

Please sign in to comment.