@codacy/ui-components

Codacy ui-components is a component library and design guide built to help us create the best experience for the Codacy platform.

Usage no npm install needed!

<script type="module">
  import codacyUiComponents from 'https://cdn.skypack.dev/@codacy/ui-components';
</script>

README

Codacy ui-components

Codacy ui-components is a component library and design guide built to help us create the best experience for the Codacy platform.

Visit our Storybook documentation to learn more.

Development

Structure

  • .aws / .circleci - Deployment scripts and configurations
  • .storybook - Storybook configurations
  • src - Components library and emotion ThemeProvider
  • stories - Storybook specific stories and components

Scripts

Install dependencies

npm install

Run storybook locally

To run storybook locally as a development environment use the following command:

npm run storybook

Build components library and styling

To build the components library for publishing run the following:

npm run build

Run tests

npm run test

You can also run the tests in watch mode by running:

npm run test:watch

Run type-checking

Running storybook locally doesn't type-check. You can run the type-checking with the following command:

npm run check-types

You can also run the type-checking in watch mode by running:

npm run check-types:watch

Create a new component

There's a template for new components. You can create the base structure for a new component just by running:

./make_component.sh [your component name here]

For example: ./make_component.sh Input.

Build details

We use babel for the build process using the react-app preset as well as the typescript compiler for the declarations output.

However take note that storybook uses its own webpack and babel configurations, even though they match the react-app preset, any other configurations might need adding in both .storybook/webpack.config.js and .babelrc

If using VSCode

You might want these extensions for linting, code style, MDX support, and styled-components highlighting:

VSCode by default uses its own version of typescript for typechecking instead of the workspace's. The ESLint Visual Studio Code extension currently doesn't have TypeScript support enabled by default. You can also run Prettier to format your code on save.

For these reasons here's an example settings file for vscode. Add the following to your project's Visual Studio Code settings file, located at .vscode/settings.json (you can create this file if it doesn't already exist):

{
  "typescript.tsdk": "node_modules/typescript/lib",
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "markdown", "mdx"],
  "[javascript]": {
    "editor.formatOnSave": true
  },
  "[javascriptreact]": {
    "editor.formatOnSave": true
  },
  "[typescript]": {
    "editor.formatOnSave": true
  },
  "[typescriptreact]": {
    "editor.formatOnSave": true
  },
  "[markdown]": {
    "editor.formatOnSave": true
  },
  "[mdx]": {
    "editor.formatOnSave": true
  }
}

What is Codacy

Codacy is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.

Among Codacy features

  • Identify new Static Analysis issues
  • Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
  • Auto-comments on Commits and Pull Requests
  • Integrations with Slack, Jira, YouTrack
  • Track issues Code Style, Security, Error Proneness, Performance, Unused Code and other categories

Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.

Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.

Free for Open Source

Codacy is free for Open Source projects.