/
๐Ÿ™…โ€โ™€๏ธ

Ignoring code

csshtmljavascripttypescript
Table of contents
  • ESlint
  • Prettier
  • TypeScript
  • Stylelint

ESlint

eslint.org/docs/use...figuring

js
/* eslint-disable */
alert('foo')
/* eslint-enable */
/* eslint-disable no-alert, no-console */
alert('foo')
console.log('bar')
/* eslint-enable no-alert, no-console */
alert('foo') // eslint-disable-line
alert('foo') // eslint-disable-line no-alert

Prettier

prettier.io/docs/en...ore.html

JavaScript

A JavaScript comment of // prettier-ignore will exclude the next node in the abstract syntax tree from formatting.

js
// prettier-ignore
matrix(
1, 0, 0,
0, 1, 0,
0, 0, 1
)

HTML

html
<!-- prettier-ignore -->
<div class="x" >hello world</div >
<!-- prettier-ignore-attribute -->
<div
(mousedown)=" onStart ( ) "
(mouseup)=" onEnd ( ) "
></div>
<!-- prettier-ignore-attribute (mouseup) -->
<div
(mousedown)="onStart()"
(mouseup)=" onEnd ( ) "
></div>

JSX

jsx
<div>
{/* prettier-ignore */}
<span ugly format='' />
</div>

CSS

css
/* prettier-ignore */
.my ugly rule
{
}

Markdown

md
<!-- prettier-ignore -->
Do not format this

This type of ignore is only allowed to be used in top-level and aimed to disable formatting for auto-generated content, e.g. all-contributors, markdown-toc, etc.

md
<!-- prettier-ignore-start -->
<!-- SOMETHING AUTO-GENERATED BY TOOLS - START -->
| MY | AWESOME | AUTO-GENERATED | TABLE |
|-|-|-|-|
| a | b | c | d |
<!-- SOMETHING AUTO-GENERATED BY TOOLS - END -->
<!-- prettier-ignore-end -->

YAML

yml
# prettier-ignore
key : value
hello: world

GraphQL

gql
{
# prettier-ignore
addReaction(input:{superLongInputFieldName:"MDU6SXNzdWUyMzEzOTE1NTE=",content:HOORAY}) {
reaction {content}
}
}

TypeScript

ts
// @ts-ignore

TSLint

ts
/* tslint:disable no-console */
console.log()
/* tslint:disable no-console */
/* tslint:disable */
/* tslint:enable */
/* tslint:disable:rule */
/* tslint:enable:rule */
/* tslint:disable-next-line */
/* tslint:disable-line */
/* tslint:disable-next-line:rule */

Stylelint

js
/* stylelint-disable */
const Container = styled.div``
/* stylelint-enable */
Want to make your own site like this?
Try gatsby-theme-code-notes by Zander Martineau.
Notes on code. My second brain, by Zander Martineau.