6.0.2 • Published 2 years ago

eslint-config-convention-fdel68 v6.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Design System Standards for Components

Filesystem and Naming conventions for exports, variables, components name, required files and folders to follow the correct format for Package structure.

Convention stablished in FDEL68: Create Linting for package filesystem structure and naming convention.

Installation

The package is intalled as usual, it's required to move configuration files into config/ folder to the root of the project. A yarn/npx command which executes lint-staged with this configuration files is also required (preferred from .husky/pre-commit) as yarn lint-staged --config convention-FDEL68... (one for each configuration).

Naming

It requires two extra files that should be at the project root convention-FDEL68-naming.config.js and convention-FDEL68.naming-rules.config.json.

convention-FDEL68-naming.config.js will receive just the commited files, then will filter them removing markdown files and json files to lint just component related ones.

convention-FDEL68.naming-rules.config.json will provide the convention-FDEL68-naming.config.js for file rules. It's just a custom configuration file which implements the convention package.

Run at pre-commit only

Currently, to acheive the whole convention topics, the configuration is splitted in two files which requires specific implementation:

As first step, install the convention as a NPM Package yarn add --dev eslint-config-convention-FDEL68 -W

Config

  1. project root : drop the files convention-FDEL68-naming.config.js and convention-FDEL68.naming-rules.config.json
  2. .husky/pre-commit : include in lint-staged command yarn lint-staged --config convention-FDEL68-naming.config.js

Acceptance Criteria

  • Naming
    1. folder/filenames
      1. should be kebab-case
    2. types/Components
      1. should be PascalCase
    3. default export
      1. should be named export

File System Structure

It requires one extra files that should be at the project root convention-FDEL68-filesystem.config.js.

convention-FDEL68-filesystem.config.js will receive a list of commited files as an array of strings, then it will validate the component package folders structure (based in acceptance criteria) and it will check for required files.

  1. .husky/pre-commit : include in lint-staged command yarn lint-staged --config convention-FDEL68-filesystem.config.js

File System Structure Scheme

  • Query : Top Level
    1. packages/component-name
  • Query : Root level (Component)
    1. ../files-in-root
    2. ../src/
  • Query : Src level
    1. ../component-files
    2. ../utils/
  • Misc : Src level

Acceptance Criteria

  • File system

    • component-name/ : Component level

      1. should have a README
      2. should have a stories
      3. should have a chromatic.stories
    • Misc :

      1. all sub-components should live inside src/components folder
      2. all utilities should live inside src/utils folder
      3. unexpected folder name under /src (allowed only /components and /utils
      4. should have a index file inside each folder

theorical assumptions about sub-component folder

A Compoenent package has the following structure:

  • Component folder (as root)
    • src folder (component files)
      • utils (inside src folder)
    • finally, files related to configs and testing

Because of this structure, where src/ and dist/ folders are the only folders in the component package, we could assume that "any other folder would be a sub-component". Then it is possible to invalidate the presence of any other folder than src.

6.0.2

2 years ago

6.0.1

2 years ago

6.0.0

2 years ago

5.2.0

2 years ago

5.1.1

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.0.2

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

3.0.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago