Git Product home page Git Product logo

code-config's Introduction

Code configurations

badge badge-ci

Collection of configurations to enforce consistent development guidelines using Maark's recommendations.

To install a new configuration you can either use the CLI to handle everything automatically or do it manually.

Using the CLI with npx

npx @maarkllc/code-config

This will guide you through a few steps that will ultimately install the desired configuration. That's it, happy coding!

Installing the CLI globally

Alternatively, you can install the code-config CLI globally and use it like so:

npm i -g @maarkllc/code-config

code-config

Available commands

If you want to skip the first step you can pass the command as a parameter. This is optional because if you don't pass anything, the CLI will ask you what you want to execute.

code-config [command]
  • eslint To install an ESLint configuration.
  • stylelint To install a Stylelint configuration.
  • githook To install a ESLint and Stylelint Git Hook commands.
  • help Shows the help screen.

e.g.

code-config eslint

// or

npx @maarkllc/code-config stylelint

Installing configurations manually

All configurations are inside the configs/ folder, categorized by tool. Each tool explains how to install it manually.

Supported configurations

The idea is to have a structure of configurations that extend from each other as needed depending on the project stack, it is important to define rules to be able to identify anti-patterns and code-smells for specific known libraries. This diagram helps illustrate the possible configurations and how it can scale in the future to include other tools of trade for bundling or unit testing:

%%{init: {'theme':'base'}}%%
graph TD
    subgraph Legend
        L1[Available]:::available --> L2[Not ready]
    end

    A[ESLint]:::available --> B[JavaScript]:::available
    B --> C[js/base]:::available
    C --> D[js/react]:::available
    C --> js/vue
    C --> js/angular
    D --> js/next

    A --> E[Typescript]

    F[Stylelint]:::available --> G[CSS]:::available
    F --> H[SCSS]:::available
    G --> css/base:::available
    H --> scss/base:::available

    Webpack

    classDef available stroke:#0B410E,fill:#94D1BE
Loading

ESLint

  • js/base: It extends from Airbnb base configuration.
  • js/react: It extends from js/base and Airbnb full configuration and hooks rules.

Stylelint

  • css/base: It extends from stylelint-config-standard.
  • scss/base: It extends from css/base and stylelint-config-standard-scss.

GitHook

Multi select (choose with spacebar one or more) between:

  • eslint: to add hook to validate eslint.
  • stylelint: to add hook to validate Stylelint.

Development

For more information please refer to the documentation.

code-config's People

Contributors

mconedera avatar orloxx avatar

Stargazers

Ashot Pahlevanyan avatar

Watchers

Emre Erkmen avatar Mark VDH avatar  avatar  avatar Alex Rodrigues avatar  avatar Jesse Oremland avatar

Forkers

valentinvoilean

code-config's Issues

React Hooks

Please add linters for react hooks.
It's easier to remove from the list in case your project has no react than to figure it out.

.git folder placement on AEM project

.git folder placement is not found if command is ran on ui.frontend folder

Soluition:
Add a step where it asks if uses the default folder or a custom one

Githook command doesn't work by itself

Happening in main branch

Steps to reproduce

  1. Execute code-config githook
  2. Choose a configuration
  3. Check .git/hook/pre-push file

Current result

  • The file is there but it's missing the selected configuration hook

Expected result

  • Selected configuration should be appended to the pre-push hook file.
  • Before adding a configuration, it should also check if it already exists to avoid duplicates.

Githook fails when .git folder is not present

Happening in main branch

Steps to reproduce:

  1. Execute code-config eslint.
  2. Choose a configuration and add a Git hook.

Current result:

Error: ENOENT: no such file or directory, copyfile 
'/.../code-config/src/app/githook/pre-push' -> '.git/hooks/pre-push'

Expected result:

  • Program should detect if the folder is not present and give notice to the user without creating the hook.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.