Skip to content

Commit

Permalink
fix(deps): update to prettier 3.3.3, stylelint-prettier 5.0.2 (carbon…
Browse files Browse the repository at this point in the history
…-design-system#17799)

* ci: stylelint16_upgrade

* fix: dedupe changes

* fix: updates to stylelint16

* refactor: added old rules back

* refactor: revert rules

* fix: updates SCSS files &  migrate to Stylelint 16.0.0

* refactor: null check

* chore: yarn dedupe changes

* refactor: refined package.json, updated rules object

* refactor: cleaned comments & package.json

* refactor: cleaned rules object

* fix(deps): update stylelint16 & prettier3

* fix(deps): stylelint-prettier5

* fix(test): update test utils to use prettier v2

* chore: run yarn format w/ prettier 3

* chore: run yarn format with prettier 3

* chore: run yarn format

* chore(deps): upgrade prettier to 3.3.3

* chore(prettier): format code

* chore(prettier): format code

---------

Co-authored-by: Taylor Jones <[email protected]>
Co-authored-by: Taylor Jones <[email protected]>
Co-authored-by: Kenny Lam <[email protected]>
  • Loading branch information
4 people authored and irfadkp committed Oct 24, 2024
1 parent f6ecc10 commit e91ea47
Show file tree
Hide file tree
Showing 120 changed files with 894 additions and 764 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion config/eslint-config-carbon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@
},
"devDependencies": {
"babel-preset-carbon": "workspace:^",
"prettier": "^2.8.8"
"prettier": "^3.3.3"
}
}
3 changes: 2 additions & 1 deletion config/stylelint-config-carbon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@
"stylelint-config-standard-scss": "^13.1.0",
"stylelint-no-unsupported-browser-features": "^8.0.1",
"stylelint-order": "^6.0.0",
"stylelint-prettier": "^5.0.0",
"stylelint-scss": "^6.2.1",
"stylelint-use-logical": "^2.1.0"
},
"devDependencies": {
"prettier": "^2.8.8",
"prettier": "^3.3.3",
"stylelint": "^16.0.0"
}
}
3 changes: 1 addition & 2 deletions docs/guides/icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ update PR:
`--modifiers`. All icons with `--modifiers` are listed as variants of the
same icon.
3. make desired edits on the icon's `aliases` list.
4. commit changes, preferably with a commit message "[icon name] metadata
update".
4. commit changes, preferably with a commit message "[icon name] metadata update".
5. create a new branch, suggested branch name is `yourname-metadata-iconName`
6. create the PR from your branch, or click on `Propose file change` if you are
in browser.
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/support.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ started in case you get stuck.
- “Could you share more about what you’ve already tried?”
- “Can you share more about your usecase?”
- “Can you add a repro (reproduction) using Stackblitz?”
- “After searching through [FILL IN RESOURCE HERE], I was able to find this and
thought it might be helpful... Let me know if that works.”
- “After searching through [FILL IN RESOURCE HERE], I was able to find this and thought
it might be helpful... Let me know if that works.”

### What does "ongoing support" mean regarding GitHub?

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"jest-junit": "^16.0.0",
"lerna": "^8.0.0",
"lint-staged": "^15.0.0",
"prettier": "^2.8.8",
"prettier": "^3.3.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"klaw-sync": "^6.0.0",
"lodash.template": "^4.5.0",
"markdown-toc": "^1.2.0",
"prettier": "^2.8.8",
"prettier": "^3.3.3",
"prettier-config-carbon": "^0.11.0",
"progress-estimator": "^0.3.0",
"remark": "^10.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/sassdoc/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

'use strict';

const prettier = require('prettier');
const prettier = require('prettier2');
const sassdoc = require('sassdoc');
const toc = require('markdown-toc');

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/sync/readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

const fs = require('fs-extra');
const path = require('path');
const prettier = require('prettier');
const prettier = require('prettier2');
const prettierConfig = require('prettier-config-carbon');
const createRemark = require('remark');
const monorepo = require('./remark/remark-monorepo');
Expand Down
2 changes: 1 addition & 1 deletion packages/colors/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async function build() {
const MODULES_ENTRYPOINT = path.resolve(__dirname, '..', 'index.scss');

await Promise.all([
fs.writeFile(MODULES_ENTRYPOINT, generate(sassModule).code),
fs.writeFile(MODULES_ENTRYPOINT, await generate(sassModule).code),
]);
}

Expand Down
5 changes: 4 additions & 1 deletion packages/feature-flags/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ async function main() {
'../scss/generated/feature-flags.scss'
);
await fs.ensureFile(generatedSassFilepath);
await fs.writeFile(generatedSassFilepath, buildSassModule(featureFlags));
await fs.writeFile(
generatedSassFilepath,
await buildSassModule(featureFlags)
);
}

const sassBanner = ` Code generated by @carbon/feature-flags. DO NOT EDIT.
Expand Down
12 changes: 8 additions & 4 deletions packages/grid/scss/_css-grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@
// Condensed
.#{$prefix}--css-grid--condensed {
--cds-grid-gutter: #{$grid-gutter-condensed};
--cds-grid-column-hang: #{math.div($grid-gutter, 2) -
math.div($grid-gutter-condensed, 2)};
--cds-grid-column-hang: #{math.div($grid-gutter, 2) - math.div(
$grid-gutter-condensed,
2
)};
}

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -179,8 +181,10 @@
.#{$prefix}--subgrid--condensed {
--cds-grid-gutter-start: #{math.div($grid-gutter-condensed, 2)};
--cds-grid-gutter-end: #{math.div($grid-gutter-condensed, 2)};
--cds-grid-column-hang: #{math.div($grid-gutter, 2) -
math.div($grid-gutter-condensed, 2)};
--cds-grid-column-hang: #{math.div($grid-gutter, 2) - math.div(
$grid-gutter-condensed,
2
)};
}

// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion packages/icon-build-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"js-yaml": "^3.12.1",
"klaw-sync": "^6.0.0",
"memfs": "^4.0.0",
"prettier": "^2.8.8",
"prettier": "^3.3.3",
"prop-types": "^15.6.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
5 changes: 2 additions & 3 deletions packages/icon-build-helpers/src/builders/vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ async function builder(metadata, { output }) {
for (const m of modules) {
files[m.filepath] = m.source;
input[m.filepath] = m.filepath;
files[
'index.js'
] += `\nexport { default as ${m.moduleName} } from '${m.filepath}';`;
files['index.js'] +=
`\nexport { default as ${m.moduleName} } from '${m.filepath}';`;
}

const bundle = await rollup({
Expand Down
5 changes: 2 additions & 3 deletions packages/icon-build-helpers/src/builders/vue/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ async function builder(metadata, { output }) {
for (const m of modules) {
files[m.filepath] = m.source;
input[m.filepath] = m.filepath;
files[
'index.js'
] += `\nexport { default as ${m.moduleName} } from '${m.filepath}';`;
files['index.js'] +=
`\nexport { default as ${m.moduleName} } from '${m.filepath}';`;
}

const bundle = await rollup({
Expand Down
2 changes: 1 addition & 1 deletion packages/icons-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@carbon/cli-reporter": "^10.7.0",
"@carbon/icons": "^11.52.0",
"fs-extra": "^11.0.0",
"prettier": "^2.8.8",
"prettier": "^3.3.3",
"rimraf": "^6.0.0",
"rollup": "^2.79.1",
"vue": "^2.6.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async function build() {
await fs.ensureDir(SCSS_DIR);
for (const { filepath, builder } of files) {
const { code } = generate(builder());
await fs.writeFile(filepath, code);
await fs.writeFile(filepath, await code);
}

reporter.success('Done! 🎉');
Expand Down
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"mini-css-extract-plugin": "^2.4.5",
"postcss": "^8.4.5",
"postcss-loader": "^8.0.0",
"prettier2": "npm:prettier@2",
"process": "^0.11.10",
"prop-types": "^15.7.2",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Button/ButtonBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useId } from '../../internal/useId';
import { ButtonBaseProps, ButtonProps } from './Button';

const ButtonBase = React.forwardRef(function ButtonBase<
T extends React.ElementType
T extends React.ElementType,
>(
{
as,
Expand Down
12 changes: 6 additions & 6 deletions packages/react/src/components/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,12 @@ const ComboBox = forwardRef(
typeahead
? autocompleteCustomFilter({ item: itemToString(item), inputValue })
: shouldFilterItem
? shouldFilterItem({
item,
itemToString,
inputValue,
})
: defaultShouldFilterItem()
? shouldFilterItem({
item,
itemToString,
inputValue,
})
: defaultShouldFilterItem()
);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Heading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type SectionProps<E extends ElementType> = PolymorphicProps<
>;

export const Section = React.forwardRef(function Section<
E extends ElementType = 'section'
E extends ElementType = 'section',
>(
{
as: BaseComponent = 'section' as E,
Expand Down
135 changes: 67 additions & 68 deletions packages/react/src/components/InlineCheckbox/InlineCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,79 +12,78 @@ import { usePrefix } from '../../internal/usePrefix';
import { useMergedRefs } from '../../internal/useMergedRefs';

/** @type any */
const InlineCheckbox = React.forwardRef(function InlineCheckbox(
props,
forwardRef
) {
const {
['aria-label']: ariaLabel,
ariaLabel: deprecatedAriaLabel,
checked = false,
disabled,
id,
indeterminate,
name,
onChange = () => {},
onClick,
onKeyDown,
title,
} = props;
const prefix = usePrefix();
const inputRef = useRef(null);
const ref = useMergedRefs([inputRef, forwardRef]);
const inputProps = {
checked,
className: `${prefix}--checkbox`,
disabled,
id,
name,
onClick: onClick ? onClickCheckBoxInput : onClick,
onChange: (evt) => {
onChange(evt.target.checked, id, evt);
},
onKeyDown,
ref,
type: 'checkbox',
};

if (indeterminate) {
inputProps.checked = false;
}

useEffect(() => {
if (inputRef?.current) {
inputRef.current.indeterminate = indeterminate;
}
}, [indeterminate]);
const InlineCheckbox = React.forwardRef(
function InlineCheckbox(props, forwardRef) {
const {
['aria-label']: ariaLabel,
ariaLabel: deprecatedAriaLabel,
checked = false,
disabled,
id,
indeterminate,
name,
onChange = () => {},
onClick,
onKeyDown,
title,
} = props;
const prefix = usePrefix();
const inputRef = useRef(null);
const ref = useMergedRefs([inputRef, forwardRef]);
const inputProps = {
checked,
className: `${prefix}--checkbox`,
disabled,
id,
name,
onClick: onClick ? onClickCheckBoxInput : onClick,
onChange: (evt) => {
onChange(evt.target.checked, id, evt);
},
onKeyDown,
ref,
type: 'checkbox',
};

function onClickCheckBoxInput(evt) {
// If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
if (indeterminate) {
evt.target.checked = false;
inputProps.checked = false;
}
onClick(evt);
}

return (
<div className={`${prefix}--checkbox--inline`}>
<input {...inputProps} />
{
/* eslint-disable jsx-a11y/label-has-for,jsx-a11y/label-has-associated-control,jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions */
<label
htmlFor={id}
className={`${prefix}--checkbox-label`}
title={title}
onClick={(evt) => {
evt.stopPropagation();
}}>
<span className={`${prefix}--visually-hidden`}>
{deprecatedAriaLabel || ariaLabel}
</span>
</label>
useEffect(() => {
if (inputRef?.current) {
inputRef.current.indeterminate = indeterminate;
}
</div>
);
});
}, [indeterminate]);

function onClickCheckBoxInput(evt) {
// If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
if (indeterminate) {
evt.target.checked = false;
}
onClick(evt);
}

return (
<div className={`${prefix}--checkbox--inline`}>
<input {...inputProps} />
{
/* eslint-disable jsx-a11y/label-has-for,jsx-a11y/label-has-associated-control,jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions */
<label
htmlFor={id}
className={`${prefix}--checkbox-label`}
title={title}
onClick={(evt) => {
evt.stopPropagation();
}}>
<span className={`${prefix}--visually-hidden`}>
{deprecatedAriaLabel || ariaLabel}
</span>
</label>
}
</div>
);
}
);

InlineCheckbox.propTypes = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Layer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface LayerComponent {
}

const LayerRenderFunction = React.forwardRef(function Layer<
T extends React.ElementType
T extends React.ElementType,
>(
{
as = 'div' as T,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export interface FilterableMultiSelectProps<ItemType>
}

const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect<
ItemType
ItemType,
>(
{
autoAlign = false,
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(function Search(
onExpand && isExpanded
? true
: onExpand && !isExpanded
? false
: undefined
? false
: undefined
}
aria-controls={onExpand ? uniqueId : undefined}>
<CustomSearchIcon icon={renderIcon} />
Expand Down
Loading

0 comments on commit e91ea47

Please sign in to comment.