Problem/Motivation

We should enforce some coding standards.

Proposed resolution

Should also be able to follow open-wc here - look at @open-wc/eslint-config, @open-wc/prettier-config
Also make sure we're formatting markdown as well.

Remaining tasks

* Install and configure Eslint
* Install and configure prettier
* Add related npm scripts.
* Document process to configure VSCode to format on save.
* Enforce with Husky

Issue fork gdwc-3203869

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

  • 3203869-prettier Comparechanges, plain diff MR !1
  • 1.0.x Comparecompare

Comments

brianperry created an issue. See original summary.

brianperry’s picture

Assigned: Unassigned » brianperry
Issue summary: View changes
brianperry’s picture

Issue summary: View changes

  • brianperry committed 119c03f on 1.0.x
    Issue #3203869 by brianperry: Configure Eslint and Prettier
    
brianperry’s picture

Status: Active » Fixed
Issue tags: +decoupledDCNA2021

Still having problems with issue forks, but merged this manually.

Content added to the docs provides a good summary of the changes:

## Linting

Staged files will be linted and formatted prior to commit using lint-staged and
husky. It is also possible to run these tasks manually using the following
commands:

npm run lint
npm run format

VSCode users can also format code on save using the
[Eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
and
[Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
extensions. These extensions will be suggested when loading the project if they
have not already been installed. An example settings file is included in
`.vscode/example.settings.json`. Save this file as `.vscode/settings.json` or
incorporate the contents into your existing settings.json file to enable format
on save in your project.

brianperry’s picture

Assigned: brianperry » Unassigned
brianperry’s picture

Status: Fixed » Closed (fixed)