Skip to content

Commit

Permalink
refactor(mdx): refactored linting rules and general markdown fixes (n…
Browse files Browse the repository at this point in the history
…odejs#2757)

Co-authored-by: Ben Halverson <[email protected]>
  • Loading branch information
ovflowd and benhalverson authored Sep 13, 2022
1 parent 99ff542 commit cf17f7e
Show file tree
Hide file tree
Showing 73 changed files with 19,483 additions and 36,132 deletions.
10 changes: 0 additions & 10 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
{
"generatorOpts": {
"compact": true,
"comments": false
},
"overrides": [
{
"test": "**/**.md",
"compact": true
}
],
"plugins": [
[
"prismjs",
Expand Down
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.cache
public
content/blog
content/api
docs/
meetings/
96 changes: 41 additions & 55 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
module.exports = {
extends: ['airbnb', 'plugin:prettier/recommended'],
env: {
browser: true,
node: true,
},
overrides: [
{
files: ['**/*.tsx'],
plugins: ['@typescript-eslint', 'react-hooks'],
files: ['**/*.{js,jsx}'],
extends: ['airbnb', 'prettier'],
env: { node: true },
},
{
files: ['**/*.{ts,tsx}'],
extends: ['airbnb', 'prettier', 'plugin:@typescript-eslint/recommended'],
plugins: ['@typescript-eslint'],
env: { browser: true, node: true },
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
settings: { 'import/resolver': { typescript: {} } },
rules: {
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'warn',
'import/prefer-default-export': 'off',
'import/extensions': 'off',
},
},
{
files: ['**/*.tsx'],
extends: [
'plugin:@typescript-eslint/recommended',
'airbnb/hooks',
'plugin:react/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
],
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {},
},
},
plugins: ['@typescript-eslint', 'react-hooks'],
parserOptions: { ecmaFeatures: { jsx: true } },
settings: { react: { version: 'detect' } },
rules: {
'react/no-unused-prop-types': 'off',
'react/require-default-props': 'off',
'react/jsx-filename-extension': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'warn',
'import/extensions': 'off',
'consistent-return': 'off',
'react/function-component-definition': [
'error',
Expand All @@ -48,48 +45,37 @@ module.exports = {
],
},
},
{
files: ['**/*.ts'],
plugins: ['@typescript-eslint', 'react-hooks'],
parser: '@typescript-eslint/parser',
settings: {
'import/resolver': {
typescript: {},
},
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
rules: {
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'warn',
'import/prefer-default-export': 'off',
'import/extensions': 'off',
},
},
{
files: [
'test-processor.js',
'test-setup.js',
'test/**',
'**/**.test.js',
'**/**.test.ts',
'**/**.test.tsx',
'test/**/**.{js,jsx,ts,tsx}',
'**/**.test.{js,jsx,ts,tsx}',
],
extends: ['plugin:testing-library/react'],
env: {
jest: true,
},
env: { jest: true, node: true, browser: true },
},
{
files: ['**/*.md'],
plugins: ['markdown'],
processor: 'markdown/markdown',
// Disable linting for API as some parts are just not compatible with MDXv2
files: ['content/**/*.{md,mdx}'],
extends: ['plugin:mdx/recommended'],
settings: { 'mdx/code-blocks': false },
rules: { 'react/jsx-no-undef': 'off' },
},
{
files: [
'content/about/*.{md,mdx}',
'content/download/*.{md,mdx}',
'content/get-involved/*.{md,mdx}',
'content/homepage/*.{md,mdx}',
'content/learn/*.m{md,mdx}',
],
settings: { 'mdx/code-blocks': true },
},
{
files: ['**/*.md/*.js', '**/*.md/*.ts'],
files: ['content/**/*.{md,mdx}/*.{js,jsx,cjs,mjs,ts,tsx}'],
rules: {
camelcase: 'off',
'@typescript-eslint/no-unused-vars': 'off',
'consistent-return': 'off',
'func-names': 'off',
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ yarn-error.log
.DS_Store
build

# Cache and Local files
.env
.env.production
.firebase/*
Expand All @@ -16,6 +17,8 @@ coverage
.history
yarn.lock
.idea/
.eslintmdcache
.eslintjscache

# Firebase
firebase-debug.log
4 changes: 0 additions & 4 deletions .remarkignore

This file was deleted.

10 changes: 0 additions & 10 deletions .remarkrc

This file was deleted.

11 changes: 6 additions & 5 deletions content/about/about.en.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: about
displayTitle: About
description: "About | Node.js"
description: 'About | Node.js'
authors: XhmikosR, mikeal, fhemberger, Fishrock123, yous, tomgco, tniessen, SMcCandlish, saadq, Trott, Gornstats, piperchester, naoufal, lpinca, j9t, bnoordhuis, harshadsabne, Chris911, benhalverson
category: about
---
Expand All @@ -24,6 +24,7 @@ const server = http.createServer((req, res) => {
});

server.listen(port, hostname, () => {
// eslint-disable-next-line no-console
console.log(`Server running at http://${hostname}:${port}/`);
});
```
Expand All @@ -39,7 +40,7 @@ reasonable to develop in Node.js.
If some of this language is unfamiliar, there is a full article on
[Blocking vs. Non-Blocking][].

---
***

Node.js is similar in design to, and influenced by, systems like Ruby's
[Event Machine][] and Python's [Twisted][]. Node.js takes the event model a bit
Expand All @@ -62,9 +63,9 @@ communicate with. Built upon that same interface is the [`cluster`][] module,
which allows you to share sockets between processes to enable load balancing
over your cores.

[Blocking vs. Non-Blocking]: /learn/overview-of-blocking-vs-non-blocking/
[blocking vs. non-blocking]: /learn/overview-of-blocking-vs-non-blocking/
[`child_process.fork()`]: /api/child_process/
[`cluster`]: https://nodejs.org/api/cluster.html
[event loop]: /learn/the-nodejs-event-loop/
[Event Machine]: https://github.com/eventmachine/eventmachine
[Twisted]: https://twistedmatrix.com/trac/
[event machine]: https://github.com/eventmachine/eventmachine
[twisted]: https://twistedmatrix.com/trac/
13 changes: 7 additions & 6 deletions content/about/about.fr.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: about
displayTitle: "À propos"
description: "À propos de | Node.js"
displayTitle: 'À propos'
description: 'À propos de | Node.js'
authors: XhmikosR, mikeal, fhemberger, Fishrock123, yous, tomgco, tniessen, SMcCandlish, saadq, Trott, Gornstats, piperchester, naoufal, lpinca, j9t, bnoordhuis, harshadsabne, Chris911, benhalverson, AugustinMauroy
category: about
---
Expand All @@ -24,6 +24,7 @@ const server = http.createServer((req, res) => {
});

server.listen(port, hostname, () => {
// eslint-disable-next-line no-console
console.log(`Le serveur fonctionne à http://${hostname}:${port}/`);
});
```
Expand All @@ -37,7 +38,7 @@ Node.js n'effectue directement des E/S, de sorte que le processus ne se bloque j
Si certains de ces termes ne vous sont pas familiers, vous trouverez un article complet sur le site suivant
[Blocage vs. non-blocage][].

***
---

Node.js est similaire dans sa conception à, et influencé par, des systèmes comme
l'[Event Machine][] de Ruby et [Twisted][] de Python. Node.js présente une
Expand All @@ -61,9 +62,9 @@ en utilisant notre API [`child_process.fork()`][], et sont conçus pour être fa
Construit sur cette même interface, le module [`cluster`][],
qui vous permet de partager des sockets entre les processus pour équilibrer la charge sur les cœurs.

[Blocage vs. non-blocage]: https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/
[Event Machine]: https://github.com/eventmachine/eventmachine
[Twisted]: https://twistedmatrix.com/trac/
[blocage vs. non-blocage]: https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/
[event machine]: https://github.com/eventmachine/eventmachine
[twisted]: https://twistedmatrix.com/trac/
[`child_process.fork()`]: https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options
[`cluster`]: https://nodejs.org/api/cluster.html
[boucle d'événement]: https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/
8 changes: 4 additions & 4 deletions content/about/governance.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ A guide for Collaborators is maintained at [collaborator-guide.md][].
The project is governed by the [Technical Steering Committee (TSC)][]
which is responsible for high-level guidance of the project.

[Consensus Seeking]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making
[README.md]: https://github.com/nodejs/node/blob/main/README.md#current-project-team-members
[TSC]: https://github.com/nodejs/TSC
[Technical Steering Committee (TSC)]: https://github.com/nodejs/TSC/blob/main/TSC-Charter.md
[consensus seeking]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making
[readme.md]: https://github.com/nodejs/node/blob/main/README.md#current-project-team-members
[tsc]: https://github.com/nodejs/TSC
[technical steering committee (tsc)]: https://github.com/nodejs/TSC/blob/main/TSC-Charter.md
[collaborator-guide.md]: https://github.com/nodejs/node/blob/main/doc/contributing/collaborator-guide.md
[nodejs/node]: https://github.com/nodejs/node
6 changes: 3 additions & 3 deletions content/about/governance.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Le projet est dirigé par le [Comité directeur technique (TSC)][]
qui est responsable de l'orientation de haut niveau du projet

[recherche de consensus]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making
[README.md]: https://github.com/nodejs/node/blob/main/README.md#current-project-team-members
[TSC]: https://github.com/nodejs/TSC
[Comité directeur technique (TSC)]: https://github.com/nodejs/TSC/blob/main/TSC-Charter.md
[readme.md]: https://github.com/nodejs/node/blob/main/README.md#current-project-team-members
[tsc]: https://github.com/nodejs/TSC
[comité directeur technique (tsc)]: https://github.com/nodejs/TSC/blob/main/TSC-Charter.md
[collaborator-guide.md]: https://github.com/nodejs/node/blob/main/doc/contributing/collaborator-guide.md
[nodejs/node]: https://github.com/nodejs/node
Loading

0 comments on commit cf17f7e

Please sign in to comment.