1.0.19 • Published 11 months ago

@synatic/eslint-config-synatic-node v1.0.19

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

lint-and-code-style

Global repo for how linting and code styling should be done for Synatic projects.

Making changes

In the root of the project is a .eslintrc.json file, this is where the majority of the rules, plugins and config will live and where you should primarily be making changes. The base file is for node projects that use mocha. You can test out changes to the base config by adding code to the ./lib-examples/ folder and your editor should be able to pick up any issues with the code which will allow you to refine the rules and verify that they work the way you would like them too.

Once you have the rules setup the way you would like to you can run the npm run copy command and this will take the config in the .eslintrc.json file and copy it to ./lib/index.js where it will be used in other projects once published.

The library also supports more advanced configuration for other project types, for example projects that use jest can make use of both the base configuration file in the root together with the jest specific config in ./lib/jest.js by having their project extend @synatic/eslint-config-synatic-node/lib/jest. Currently there is no way to test these specific configurations in this project without copying them to the .eslintrc.json file and testing them, but do not leave them there when committing or else they will apply to the shared base configuration.

Once you have made all the above changes and ran the npm run copy command you can commit to git run the npm version <major,minor,patch> command to increment the version, push to develop and submit a PR as normal.

Adding to your project

To add the shared configuration to your project you can do the following:

  1. run npm i -D @synatic/eslint-config-synatic-node in your project
  2. create a .eslintrc.json file in your project
  3. Add the following code:
    {
        "env": {},
        "extends": ["@synatic/eslint-config-synatic-node"],
        "globals": {},
        "parserOptions": {},
        "overrides": [],
        "rules": {}
    }
  4. If you would prefer to use a different config from the base one, simply replace the extends in the above example with your desired one.
  5. create a .prettierrc.json in your project and inside it add the code from this repositories version of the file as this will be the most up to date version
  6. Install the peer dependencies listed in this project's package.json file, which can be found under peerDependencies
  7. Ensure your package.json has the correct engine section, e.g.:
    "engines": {
        "node": ">=14.0.0",
        "npm": ">=6.0.0"
    },
  1. Ensure your package.json has the required scripts:
    "lint": "eslint .",
    "lint-fix": "eslint . --fix",
    "lint-errors": "eslint . --quiet",
    "prettier": "prettier . --write"

Configs available

  • @synatic/eslint-config-synatic-node
  • @synatic/eslint-config-synatic-node/lib/jest
1.0.19

11 months ago

1.0.18

11 months ago

1.0.17

1 year ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

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