A set of configurations for several code formatting and linting tools to be used in all Splist projects.
For all projects you should have your prettier.config.js
(it must end in .js
) file use the base Prettier config:
// prettier.config.js
const { prettier } = require('code-style');
module.exports = prettier;
Using Prettier only requires you to install the prettier
package.
Internally there is a base ESLint config that other configurations inherit rules and plugins from.
For each config you are putting the code snippet in your .eslintrc.js
file.
All configurations require the following dependencies:
// .eslintrc.js
const { eslint } = require('code-style');
const { base } = eslint;
module.exports = base;
No extra dependencies other than the base ones.
// .eslintrc.js
const { eslint } = require('code-style');
const { typeScript } = eslint;
module.exports = typeScript;
Note: there is no JavaScript and React config.
// .eslintrc.js
const { eslint } = require('code-style');
const { tsx } = eslint;
module.exports = tsx;
These rules should enforce a clear and consistent style across all files. When applicable, throw warnings when something is wrong and errors when something could cause a bug.
For example, using double equals could cause unexpected behavior and should throw an error. Not using dot notation won't cause any unexpected behavior, so it should throw a warning.
Most Splist projects use TypeScript. Originally this was written in TypeScript, however ESLint is unable to run a TypeScript file. For that reason this project is written in plain JavaScript.
If you want to show that you are using this code style you can use the following badge
[](https://github.com/Splist/code-style)