Skip to content
/ ofmt Public
forked from ottofeller/ofmt

Eslint config utilized in ottofeller.com projects

Notifications You must be signed in to change notification settings

quesabe/ofmt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OFMT is a formatting and linting tool

  • Formatting is done solely by prettier. It is completely automated, and not configurable in any way other than changing the .prettierrc of this repo, and republishing the package.
  • Linting is not related to formatting in any way. The goal of linting is to catch early code quality issues, and enforce usage of best practices.

Install

Use the following command to instal the package as a dev dependency:

npm install @ottofeller/ofmt --save-dev

The package implements an install command that copies prettier and eslint configs to your project - it creates a symlink to prettier config file and adds/extends eslint config within package.json. See the Examples sections for usage details.
NOTE: the install script does not attempt to overwrite existing prettier config - if a .prettierrc file exists it is left as is. An existing eslint config is extended with eslint.quality.cjs.

Configs

The project contains the following configs:

  • .prettierrc formatting rules
  • eslint.quality.cjs with JS/TS-specific code quality and best practices rules
  • eslint.tailwind.cjs same as above, CSS-specific

Direct use of configs is meant only for IDE support. For CLI runs use the provided executables.

Executables

There are two bin files that perform the code checking:

  • ofmt - prettier formatter. A single option is available:
    -l, --lint - a flag to perform checking only. Without the flag prettier will rewrite files with fixed formatting.
  • olint - code quality and best practices linter.

Examples:

NOTE: The examples below use shorthand executable name as registered in PATH by npm - available only if the package is installed in the project or in upper scopes on the search path of npm. If the @ottofeller/ofmt is not installed append with the package name:\

npx -p @ottofeller/ofmt [ofmt|olint] ...

Check TS files with prettier

npx ofmt -l './src/**/*.ts'

Fix TS files with prettier

npx ofmt './src/**/*.ts'

Install prettier and eslint configs to your project

npx ofmt install .

NOTE: if run as npm-script the path will be inferred:

"scripts": {
  "ofmt:install": "ofmt install",
  ...
}
npm run ofmt:install

Check TS files with eslint

npx olint './src/**/*.ts'

About

Eslint config utilized in ottofeller.com projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%