README
Splist Code Style
A set of configurations for several code formatting and linting tools to be used in all Splist projects.
Usage
Prettier
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;
Dependencies
Using Prettier only requires you to install the prettier
package.
ESLint
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.
Dependencies
All configurations require the following dependencies:
JavaScript
// .eslintrc.js
const { eslint } = require('code-style');
const { base } = eslint;
module.exports = base;
Dependencies
No extra dependencies other than the base ones.
TypeScript
// .eslintrc.js
const { eslint } = require('code-style');
const { typeScript } = eslint;
module.exports = typeScript;
Dependencies
TypeScript and React (TSX)
Note: there is no JavaScript and React config.
// .eslintrc.js
const { eslint } = require('code-style');
const { tsx } = eslint;
module.exports = tsx;
Dependencies
Philosophy
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.
Why this doesn't use TypeScript
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.
Badge
If you want to show that you are using this code style you can use the following badge
Markdown
[![style: splist](https://img.shields.io/badge/style-splist-730da7)](https://github.com/Splist/code-style)