From 29cf7040cd5aefc3e7230946b748465d2295cc61 Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Sun, 17 Sep 2023 13:53:36 +0800 Subject: [PATCH] chore: add enforce-node-prefix on readme by default --- README.md | 36 +++++++++++++++++++----------------- lib/rules/best-practices.js | 2 -- lib/rules/browser.js | 2 -- lib/rules/errors.js | 2 -- lib/rules/es2020.js | 2 -- lib/rules/es6.js | 2 -- lib/rules/import.js | 2 -- lib/rules/jsdoc.js | 2 -- lib/rules/node.js | 2 -- lib/rules/react-a11y.js | 2 -- lib/rules/react.js | 2 -- lib/rules/strict.js | 2 -- lib/rules/style.js | 2 -- lib/rules/typescript.js | 2 -- lib/rules/variables.js | 2 -- test/eggache.test.js | 2 -- test/es2018.test.js | 2 -- test/es2020.test.js | 2 -- test/es8.test.js | 2 -- test/index.test.js | 2 -- test/jsdoc.test.js | 2 -- test/legacy.test.js | 2 -- test/node.test.js | 2 -- test/react.test.js | 2 -- 24 files changed, 19 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 60e925c..79bec61 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ [download-image]: https://img.shields.io/npm/dm/eslint-config-egg.svg?style=flat-square [download-url]: https://npmjs.org/package/eslint-config-egg -Node.js Style Guide for Egg. +Node.js Style Guide for Eggjs and Node.js ## Install @@ -27,6 +27,8 @@ npm i eslint eslint-config-egg --save-dev ## Usage +### Use with JavaScript project + - `package.json` ```json @@ -38,12 +40,15 @@ npm i eslint eslint-config-egg --save-dev } ``` -- `.eslintrc.js` +- `.eslintrc` -```js -module.exports = { - extends: 'eslint-config-egg', -}; +```json +{ + "extends": [ + "eslint-config-egg", + "eslint-config-egg/lib/rules/enforce-node-prefix" + ] +} ``` ### Use with TypeScript project @@ -59,18 +64,15 @@ module.exports = { } ``` -- `.eslintrc.js` +- `.eslintrc` -```js -module.exports = { - extends: 'eslint-config-egg/typescript', - parserOptions: { - // recommend to use another config file like tsconfig.eslint.json and extends tsconfig.json in it. - // because you may be need to lint test/**/*.test.ts but no need to emit to js. - // @see https://github.com/typescript-eslint/typescript-eslint/issues/890 - project: './tsconfig.json' - } -}; +```json +{ + "extends": [ + "eslint-config-egg/typescript", + "eslint-config-egg/lib/rules/enforce-node-prefix" + ] +} ``` - `scripts` diff --git a/lib/rules/best-practices.js b/lib/rules/best-practices.js index 8ca341e..b388ae3 100644 --- a/lib/rules/best-practices.js +++ b/lib/rules/best-practices.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { rules: { /** diff --git a/lib/rules/browser.js b/lib/rules/browser.js index 7a53dc3..c38aa97 100644 --- a/lib/rules/browser.js +++ b/lib/rules/browser.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { env: { browser: true, diff --git a/lib/rules/errors.js b/lib/rules/errors.js index 46ca841..306f0ac 100644 --- a/lib/rules/errors.js +++ b/lib/rules/errors.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { rules: { /** diff --git a/lib/rules/es2020.js b/lib/rules/es2020.js index 97e361f..907411e 100644 --- a/lib/rules/es2020.js +++ b/lib/rules/es2020.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { env: { es2020: true, diff --git a/lib/rules/es6.js b/lib/rules/es6.js index 1ab3099..8804e55 100644 --- a/lib/rules/es6.js +++ b/lib/rules/es6.js @@ -2,8 +2,6 @@ * ES6 */ -'use strict'; - module.exports = { env: { es6: true, diff --git a/lib/rules/import.js b/lib/rules/import.js index 9afd0ba..0574220 100644 --- a/lib/rules/import.js +++ b/lib/rules/import.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { env: { es6: true, diff --git a/lib/rules/jsdoc.js b/lib/rules/jsdoc.js index b15f183..7cde40b 100644 --- a/lib/rules/jsdoc.js +++ b/lib/rules/jsdoc.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { plugins: [ 'jsdoc' ], settings: { diff --git a/lib/rules/node.js b/lib/rules/node.js index ff52486..edc869d 100644 --- a/lib/rules/node.js +++ b/lib/rules/node.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { env: { node: true, diff --git a/lib/rules/react-a11y.js b/lib/rules/react-a11y.js index 2966beb..178e93c 100644 --- a/lib/rules/react-a11y.js +++ b/lib/rules/react-a11y.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { plugins: [ 'jsx-a11y', diff --git a/lib/rules/react.js b/lib/rules/react.js index 21787e9..7b5b362 100644 --- a/lib/rules/react.js +++ b/lib/rules/react.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { plugins: [ 'react', diff --git a/lib/rules/strict.js b/lib/rules/strict.js index 03734ea..7953140 100644 --- a/lib/rules/strict.js +++ b/lib/rules/strict.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { rules: { /** diff --git a/lib/rules/style.js b/lib/rules/style.js index 9e4807c..36b492e 100644 --- a/lib/rules/style.js +++ b/lib/rules/style.js @@ -1,5 +1,3 @@ -'use strict'; - const os = require('os'); module.exports = { diff --git a/lib/rules/typescript.js b/lib/rules/typescript.js index 6507a5e..37f9439 100644 --- a/lib/rules/typescript.js +++ b/lib/rules/typescript.js @@ -1,5 +1,3 @@ -'use strict'; - /** * all rules https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules */ diff --git a/lib/rules/variables.js b/lib/rules/variables.js index 4af7cba..8f86333 100644 --- a/lib/rules/variables.js +++ b/lib/rules/variables.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { rules: { /** diff --git a/test/eggache.test.js b/test/eggache.test.js index 4ecfed0..dcdac55 100644 --- a/test/eggache.test.js +++ b/test/eggache.test.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const coffee = require('coffee'); diff --git a/test/es2018.test.js b/test/es2018.test.js index ebd7ff0..c26fbbb 100644 --- a/test/es2018.test.js +++ b/test/es2018.test.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const coffee = require('coffee'); diff --git a/test/es2020.test.js b/test/es2020.test.js index 1c7b7f5..4fc9a7f 100644 --- a/test/es2020.test.js +++ b/test/es2020.test.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const coffee = require('coffee'); diff --git a/test/es8.test.js b/test/es8.test.js index 58d50f5..8f2b728 100644 --- a/test/es8.test.js +++ b/test/es8.test.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const coffee = require('coffee'); diff --git a/test/index.test.js b/test/index.test.js index 18e402a..d72ca61 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const coffee = require('coffee'); diff --git a/test/jsdoc.test.js b/test/jsdoc.test.js index 31ee5d0..d275418 100644 --- a/test/jsdoc.test.js +++ b/test/jsdoc.test.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const coffee = require('coffee'); diff --git a/test/legacy.test.js b/test/legacy.test.js index 0dc8fca..23e7b5e 100644 --- a/test/legacy.test.js +++ b/test/legacy.test.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const coffee = require('coffee'); diff --git a/test/node.test.js b/test/node.test.js index 0ba2236..f83ca7f 100644 --- a/test/node.test.js +++ b/test/node.test.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const coffee = require('coffee'); diff --git a/test/react.test.js b/test/react.test.js index 2aec8a8..3e46874 100644 --- a/test/react.test.js +++ b/test/react.test.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const coffee = require('coffee');