@synatic/eslint-config-synatic-node

2.0.0 • Public • Published

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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.029latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.029
1.0.190
1.0.180
1.0.170
1.0.160
1.0.150
1.0.140
1.0.130
1.0.120
1.0.110
1.0.101
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.21
1.0.10
1.0.01

Package Sidebar

Install

npm i @synatic/eslint-config-synatic-node

Weekly Downloads

25

Version

2.0.0

License

MIT

Unpacked Size

7.28 kB

Total Files

4

Last publish

Collaborators

  • filepounder-dev
  • thiren
  • synatic-devops