kebab-case
when creating any files..tsx
..ts
exclusively.cms-library
directory, create a new folder named after your theme component. This folder will store all the component’s files..tsx
extension. This file is responsible for returning the component’s JSX code..ts
extension. This file will contain all the business logic for your component, separate from the JSX.index.ts
file. This file will act as the entry point, potentially exporting the main component and any helper functions from the controller file.index.ts
):
cms-library
(likely named components
), locate the index.ts
file.index.ts
file to include an entry for your newly created component. This typically involves importing the component from its folder location and adding it to an export statement.cms-library
.
camelCase
for prop names, or snake-case
if the prop value is a React component.utils
folder and exporting them from its index.
Do not use underscore prefix for internal methods of a React component.
componetns/index.ts
, public/index.ts
dictate a plugin’s public API. The public API should be carefully controlled, and using export *
makes it very easy for a developer working on internal changes to export a new public API unintentionally:
any
whenever possibleunknown
type, there are seldom reasons to employ any
as a type. Nearly all instances where any
was previously used can be substituted with either a generic or unknown
type (in cases where the type is genuinely unknown).
It’s advisable to consistently utilize these mechanisms over any
, as they offer stricter typing and are less prone to introducing bugs in the future due to inadequate types.
If your plugin does not utilize any
or if you’re initiating a new plugin, it’s recommended to enable the @typescript-eslint/no-explicit-any
linting rule for your plugin via the .eslintrc.js
configuration.
src/assets/scss/app.scss
for global mapping.