diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml
index 58f05ed..7602390 100644
--- a/.github/workflows/nodejs.yml
+++ b/.github/workflows/nodejs.yml
@@ -3,7 +3,6 @@ name: CI
on:
push:
branches: [ master ]
-
pull_request:
branches: [ master ]
@@ -13,4 +12,4 @@ jobs:
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest'
- version: '16, 18, 20'
+ version: '18.19.0, 18, 20, 22'
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 67291ef..a2bf04a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,5 +11,3 @@ jobs:
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
- with:
- checkTest: false
diff --git a/README.md b/README.md
index 79bec61..3e1e849 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 Eggjs and Node.js
+Node.js Style Guide for EggJS
## Install
@@ -34,7 +34,7 @@ npm i eslint eslint-config-egg --save-dev
```json
{
"devDependencies": {
- "eslint-config-egg": "13",
+ "eslint-config-egg": "14",
"eslint": "8"
}
}
@@ -45,8 +45,7 @@ npm i eslint eslint-config-egg --save-dev
```json
{
"extends": [
- "eslint-config-egg",
- "eslint-config-egg/lib/rules/enforce-node-prefix"
+ "eslint-config-egg"
]
}
```
@@ -59,7 +58,7 @@ npm i eslint eslint-config-egg --save-dev
{
"devDependencies": {
"eslint-config-egg": "13",
- "typescript": "^4.5.2"
+ "typescript": "5"
}
}
```
@@ -69,8 +68,7 @@ npm i eslint eslint-config-egg --save-dev
```json
{
"extends": [
- "eslint-config-egg/typescript",
- "eslint-config-egg/lib/rules/enforce-node-prefix"
+ "eslint-config-egg/typescript"
]
}
```
@@ -93,98 +91,17 @@ npm i eslint eslint-config-egg --save-dev
{
"language": "typescript",
"autoFix": true
- },
+ }
]
}
```
-### Use with Experimental Features
-
-If you want to use eslint-config-egg with experimental features such as `async function`, you should use `@babel/eslint-parser` parser:
-
-- `package.json`
-
-```json
-{
- "devDependencies": {
- "eslint-config-egg": "13",
- "eslint": "8",
- "@babel/core": "7",
- "@babel/eslint-parser": "7"
- }
-}
-```
-
-- `.eslintrc.js`
-
-```js
-module.exports = {
- extends: 'eslint-config-egg',
- // for experimental features support
- parser: '@babel/eslint-parser',
- rules: {
- // see https://github.com/eslint/eslint/issues/6274
- 'generator-star-spacing': 'off',
- 'babel/generator-star-spacing': 'off',
- }
-};
-```
-
-### Use with React in Front-End
-
-If you want to use eslint-config-egg with react, jsx and es6 modules:
-
-- `package.json`
-
-```json
-{
- "devDependencies": {
- "eslint-config-egg": "13",
- "eslint": "8",
- "@babel/core": "7",
- "@babel/eslint-parser": "7",
- "eslint-plugin-react": "7"
- }
-}
-```
-
-- `.eslintrc.js`
-
-```js
-module.exports = {
- extends: 'eslint-config-egg',
- // for experimental features support
- parser: '@babel/eslint-parser',
- parserOptions: {
- // for es6 module
- sourceType: 'module',
- },
- plugins: [
- 'react',
- ],
- rules: {
- // for variables in jsx
- 'react/jsx-uses-vars': 'error',
- // see https://github.com/eslint/eslint/issues/6274
- 'generator-star-spacing': 'off',
- 'babel/generator-star-spacing': 'off',
- },
-};
-```
-
## License
[MIT](LICENSE)
-
-
## Contributors
-|[![](https://avatars.githubusercontent.com/u/360661?v=4)
popomore](https://github.com/popomore)
|[![](https://avatars.githubusercontent.com/u/156269?v=4)
fengmk2](https://github.com/fengmk2)
|[![](https://avatars.githubusercontent.com/u/5856440?v=4)
whxaxes](https://github.com/whxaxes)
|[![](https://avatars.githubusercontent.com/u/227713?v=4)
atian25](https://github.com/atian25)
|[![](https://avatars.githubusercontent.com/u/3580607?v=4)
benjycui](https://github.com/benjycui)
|[![](https://avatars.githubusercontent.com/u/3274850?v=4)
geekdada](https://github.com/geekdada)
|
-| :---: | :---: | :---: | :---: | :---: | :---: |
-|[![](https://avatars.githubusercontent.com/u/985607?v=4)
dead-horse](https://github.com/dead-horse)
|[![](https://avatars.githubusercontent.com/u/2039144?v=4)
sang4lv](https://github.com/sang4lv)
|[![](https://avatars.githubusercontent.com/u/2972143?v=4)
nightink](https://github.com/nightink)
|[![](https://avatars.githubusercontent.com/u/2724034?v=4)
missjing](https://github.com/missjing)
|[![](https://avatars.githubusercontent.com/u/9857273?v=4)
ShadyZOZ](https://github.com/ShadyZOZ)
|[![](https://avatars.githubusercontent.com/u/15117664?v=4)
zhaoxingyue](https://github.com/zhaoxingyue)
|
-[![](https://avatars.githubusercontent.com/u/10082151?v=4)
bowei-jbw](https://github.com/bowei-jbw)
|[![](https://avatars.githubusercontent.com/u/13050025?v=4)
aladdin-add](https://github.com/aladdin-add)
|[![](https://avatars.githubusercontent.com/u/143572?v=4)
hotoo](https://github.com/hotoo)
-
-This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Thu Jun 02 2022 15:10:46 GMT+0800`.
+[![Contributors](https://contrib.rocks/image?repo=eggjs/eslint-config-egg)](https://github.com/eggjs/eslint-config-egg/graphs/contributors)
-
+Made with [contributors-img](https://contrib.rocks).
diff --git a/index.js b/index.js
index 01983ea..c3c1342 100644
--- a/index.js
+++ b/index.js
@@ -1,7 +1,8 @@
const builtin = [
'./lib/legacy',
+ './lib/rules/enforce-node-prefix',
'./lib/rules/es6',
- './lib/rules/es2020',
+ './lib/rules/es2022',
].map(require.resolve);
module.exports = {
@@ -9,7 +10,7 @@ module.exports = {
'plugin:eggache/recommended',
]),
parserOptions: {
- ecmaVersion: 2020,
+ ecmaVersion: 2022,
sourceType: 'script',
},
};
diff --git a/lib/rules/es2020.js b/lib/rules/es2022.js
similarity index 66%
rename from lib/rules/es2020.js
rename to lib/rules/es2022.js
index 907411e..6c7f473 100644
--- a/lib/rules/es2020.js
+++ b/lib/rules/es2022.js
@@ -1,5 +1,5 @@
module.exports = {
env: {
- es2020: true,
+ es2022: true,
},
};
diff --git a/lib/rules/react-a11y.js b/lib/rules/react-a11y.js
deleted file mode 100644
index 178e93c..0000000
--- a/lib/rules/react-a11y.js
+++ /dev/null
@@ -1,108 +0,0 @@
-module.exports = {
- plugins: [
- 'jsx-a11y',
- 'react',
- ],
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
- rules: {
- // Enforce that anchors have content
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md
- 'jsx-a11y/anchor-has-content': [ 'error', { components: [ '' ] }],
-
- // Require ARIA roles to be valid and non-abstract
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
- 'jsx-a11y/aria-role': 'error',
-
- // Enforce all aria-* props are valid.
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md
- 'jsx-a11y/aria-props': 'error',
-
- // Enforce ARIA state and property values are valid.
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md
- 'jsx-a11y/aria-proptypes': 'error',
-
- // Enforce that elements that do not support ARIA roles, states, and
- // properties do not have those attributes.
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
- 'jsx-a11y/aria-unsupported-elements': 'error',
-
- // disallow href "#"
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md
- 'jsx-a11y/anchor-is-valid': [ 'error', { components: [ 'a' ] }],
-
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
- 'jsx-a11y/alt-text': 'error',
-
- // Prevent img alt text from containing redundant words like "image", "picture", or "photo"
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md
- 'jsx-a11y/img-redundant-alt': 'error',
-
- // require that JSX labels use "htmlFor"
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md
- 'jsx-a11y/label-has-for': [ 'error', { components: [ 'label' ] }],
-
- // require that mouseover/out come with focus/blur, for keyboard-only users
- // TODO: evaluate
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
- 'jsx-a11y/mouse-events-have-key-events': 'off',
-
- // Prevent use of `accessKey`
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md
- 'jsx-a11y/no-access-key': 'error',
-
- // require onBlur instead of onChange
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md
- 'jsx-a11y/no-onchange': 'off',
-
- // Enforce that elements with onClick handlers must be focusable.
- // TODO: evaluate
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/onclick-has-focus.md
- 'jsx-a11y/onclick-has-focus': 'off',
-
- // Enforce that elements with ARIA roles must have all required attributes
- // for that role.
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md
- 'jsx-a11y/role-has-required-aria-props': 'error',
-
- // Enforce that elements with explicit or implicit roles defined contain
- // only aria-* properties supported by that role.
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md
- 'jsx-a11y/role-supports-aria-props': 'error',
-
- // Enforce tabIndex value is not greater than zero.
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
- 'jsx-a11y/tabindex-no-positive': 'error',
-
- // ensure tags have content and are not aria-hidden
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
- 'jsx-a11y/heading-has-content': [ 'error', { components: [ '' ] }],
-
- // require HTML elements to have a "lang" prop
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
- 'jsx-a11y/html-has-lang': 'error',
-
- // require HTML element's lang prop to be valid
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
- 'jsx-a11y/lang': 'error',
-
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
- 'jsx-a11y/no-distracting-elements': [ 'error', { elements: [ 'marquee' ] }],
-
- // only allow to have the "scope" attr
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
- 'jsx-a11y/scope': 'error',
-
- // require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
- // TODO: enable?
- 'jsx-a11y/click-events-have-key-events': 'off',
-
- // Enforce that DOM elements without semantic behavior not have interaction handlers
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
- 'jsx-a11y/no-static-element-interactions': 'error',
- },
-};
diff --git a/lib/rules/react.js b/lib/rules/react.js
deleted file mode 100644
index 7b5b362..0000000
--- a/lib/rules/react.js
+++ /dev/null
@@ -1,305 +0,0 @@
-module.exports = {
- plugins: [
- 'react',
- ],
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
- // View link below for react rules documentation
- // https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
- rules: {
- // Specify whether double or single quotes should be used in JSX attributes
- // http://eslint.org/docs/rules/jsx-quotes
- 'jsx-quotes': [ 'error', 'prefer-double' ],
-
- 'class-methods-use-this': [ 'error', {
- exceptMethods: [
- 'render',
- 'getInitialState',
- 'getDefaultProps',
- 'getChildContext',
- 'componentWillMount',
- 'componentDidMount',
- 'componentWillReceiveProps',
- 'shouldComponentUpdate',
- 'componentWillUpdate',
- 'componentDidUpdate',
- 'componentWillUnmount',
- ],
- }],
-
- // Prevent missing displayName in a React component definition
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
- 'react/display-name': [ 'off', { ignoreTranspilerName: false }],
-
- // Forbid certain propTypes (any, array, object)
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
- 'react/forbid-prop-types': [ 'off' ],
-
- // Enforce boolean attributes notation in JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
- 'react/jsx-boolean-value': [ 'error', 'never' ],
-
- // Validate closing bracket location in JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
- 'react/jsx-closing-bracket-location': [ 'error', 'line-aligned' ],
-
- // Enforce or disallow spaces inside of curly braces in JSX attributes
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
- 'react/jsx-curly-spacing': [ 'error', 'never', { allowMultiline: true }],
-
- // Enforce event handler naming conventions in JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
- 'react/jsx-handler-names': [ 'off', {
- eventHandlerPrefix: 'handle',
- eventHandlerPropPrefix: 'on',
- }],
-
- // Validate props indentation in JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
- 'react/jsx-indent-props': [ 'error', 2 ],
-
- // Validate JSX has key prop when in array or iterator
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
- 'react/jsx-key': 'off',
-
- // Limit maximum of props on a single line in JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
- 'react/jsx-max-props-per-line': [ 'off', { maximum: 1 }],
-
- // Prevent usage of .bind() in JSX props
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
- 'react/jsx-no-bind': [ 'error', {
- ignoreRefs: true,
- allowArrowFunctions: true,
- allowBind: false,
- }],
-
- // Prevent duplicate props in JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
- 'react/jsx-no-duplicate-props': [ 'error', { ignoreCase: true }],
-
- // Prevent usage of unwrapped JSX strings
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
- 'react/jsx-no-literals': 'off',
-
- // Disallow undeclared variables in JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
- 'react/jsx-no-undef': 'error',
-
- // Enforce PascalCase for user-defined JSX components
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
- 'react/jsx-pascal-case': [ 'error', {
- allowAllCaps: true,
- ignore: [],
- }],
-
- // Enforce propTypes declarations alphabetical sorting
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
- 'react/sort-prop-types': [ 'off', {
- ignoreCase: true,
- callbacksLast: false,
- requiredFirst: false,
- }],
-
- // Deprecated in favor of react/jsx-sort-props
- 'react/jsx-sort-prop-types': 'off',
-
- // Enforce props alphabetical sorting
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
- 'react/jsx-sort-props': [ 'off', {
- ignoreCase: true,
- callbacksLast: false,
- shorthandFirst: false,
- shorthandLast: false,
- }],
-
- // Prevent React to be incorrectly marked as unused
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
- 'react/jsx-uses-react': [ 'error' ],
-
- // Prevent variables used in JSX to be incorrectly marked as unused
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
- 'react/jsx-uses-vars': 'error',
-
- // Prevent usage of dangerous JSX properties
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
- 'react/no-danger': 'warn',
-
- // Prevent usage of deprecated methods
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
- 'react/no-deprecated': [ 'error' ],
-
- // Prevent usage of setState in componentDidMount
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
- 'react/no-did-mount-set-state': [ 'error' ],
-
- // Prevent usage of setState in componentDidUpdate
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
- 'react/no-did-update-set-state': [ 'error' ],
-
- // Prevent direct mutation of this.state
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
- 'react/no-direct-mutation-state': 'off',
-
- // Prevent usage of isMounted
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
- 'react/no-is-mounted': 'error',
-
- // Prevent multiple component definition per file
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
- 'react/no-multi-comp': [ 'error', { ignoreStateless: true }],
-
- // Prevent usage of setState
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
- 'react/no-set-state': 'off',
-
- // Prevent using string references
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
- 'react/no-string-refs': 'error',
-
- // Prevent usage of unknown DOM property
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
- 'react/no-unknown-property': 'error',
-
- // Require ES6 class declarations over React.createClass
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
- 'react/prefer-es6-class': [ 'error', 'always' ],
-
- // Require stateless functions when not using lifecycle methods, setState or ref
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
- 'react/prefer-stateless-function': 'off',
-
- // Prevent missing props validation in a React component definition
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
- 'react/prop-types': [ 'error', { ignore: [], customValidators: [] }],
-
- // Prevent missing React when using JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
- 'react/react-in-jsx-scope': 'error',
-
- // Require render() methods to return something
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
- 'react/require-render-return': 'error',
-
- // Prevent extra closing tags for components without children
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
- 'react/self-closing-comp': 'error',
-
- // Enforce component methods order
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
- 'react/sort-comp': [ 'error', {
- order: [
- 'static-methods',
- 'lifecycle',
- '/^on.+$/',
- '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
- 'everything-else',
- '/^render.+$/',
- 'render',
- ],
- }],
-
- // Prevent missing parentheses around multilines JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
- 'react/jsx-wrap-multilines': [ 'error', {
- declaration: true,
- assignment: true,
- return: true,
- }],
-
- // Require that the first prop in a JSX element be on a new line when the element is multiline
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
- 'react/jsx-first-prop-new-line': [ 'error', 'multiline' ],
-
- // Enforce spacing around jsx equals signs
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
- 'react/jsx-equals-spacing': [ 'error', 'never' ],
-
- // Enforce JSX indentation
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
- 'react/jsx-indent': [ 'error', 2 ],
-
- // Disallow target="_blank" on links
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
- 'react/jsx-no-target-blank': 'error',
-
- // only .jsx files may have JSX
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
- 'react/jsx-filename-extension': [ 'error', { extensions: [ '.jsx' ] }],
-
- // prevent accidental JS comments from being injected into JSX as text
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
- 'react/jsx-no-comment-textnodes': 'error',
-
- // disallow using React.render/ReactDOM.render's return value
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
- 'react/no-render-return-value': 'error',
-
- // require a shouldComponentUpdate method, or PureRenderMixin
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
- 'react/require-optimization': [ 'off', { allowDecorators: [] }],
-
- // warn against using findDOMNode()
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
- 'react/no-find-dom-node': 'error',
-
- // Forbid certain props on Components
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
- 'react/forbid-component-props': [ 'off', { forbid: [] }],
-
- // Prevent problem with children and props.dangerouslySetInnerHTML
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
- 'react/no-danger-with-children': 'error',
-
- // Prevent unused propType definitions
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
- 'react/no-unused-prop-types': [ 'error', {
- customValidators: [
- ],
- skipShapeProps: true,
- }],
-
- // Require style prop value be an object or var
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
- 'react/style-prop-object': 'error',
-
- // Prevent invalid characters from appearing in markup
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
- 'react/no-unescaped-entities': 'error',
-
- // Prevent passing of children as props
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
- 'react/no-children-prop': 'error',
-
- // Validate whitespace in and around the JSX opening and closing brackets
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
- 'react/jsx-tag-spacing': [ 'error', {
- closingSlash: 'never',
- beforeSelfClosing: 'always',
- afterOpening: 'never',
- }],
-
- // Prevent usage of Array index in keys
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
- 'react/no-array-index-key': 'error',
-
- // Enforce a defaultProps definition for every prop that is not a required prop
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
- 'react/require-default-props': 'off',
- },
-
- settings: {
- 'import/resolver': {
- node: {
- extensions: [ '.js', '.jsx', '.json' ],
- },
- },
- react: {
- pragma: 'React',
- version: '0.14',
- },
- },
-};
diff --git a/lib/rules/style.js b/lib/rules/style.js
index 36b492e..1768093 100644
--- a/lib/rules/style.js
+++ b/lib/rules/style.js
@@ -1,4 +1,4 @@
-const os = require('os');
+const os = require('node:os');
module.exports = {
rules: {
diff --git a/lib/rules/typescript.js b/lib/rules/typescript.js
index 37f9439..5b8d64b 100644
--- a/lib/rules/typescript.js
+++ b/lib/rules/typescript.js
@@ -27,13 +27,13 @@ module.exports = {
],
/**
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.mdx
*/
semi: 'off',
'@typescript-eslint/semi': [ 'error' ],
/**
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.mdx
*/
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [ 'error', {
@@ -42,20 +42,20 @@ module.exports = {
}],
/**
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.mdx
*/
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': [ 'error' ],
/**
* An empty interface is equivalent to its supertype
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.mdx
*/
'@typescript-eslint/no-empty-interface': 'off',
/**
* Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.mdx
*/
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [ 'error', {
@@ -65,19 +65,19 @@ module.exports = {
/**
* Enforce camelCase naming convention
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/camelcase.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/camelcase.mdx
*/
'@typescript-eslint/camelcase': 'off',
/**
* Require explicit return types on functions and class methods
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.mdx
*/
'@typescript-eslint/explicit-function-return-type': 'off',
/**
* Require explicit accessibility modifiers on class properties and methods (`member-access` from TSLint)
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.mdx
*/
'@typescript-eslint/explicit-member-accessibility': 'off',
@@ -87,7 +87,7 @@ module.exports = {
/**
* Enforce consistent indentation (`indent` from TSLint)
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.mdx
*/
'@typescript-eslint/indent': [ 'error', 2, {
SwitchCase: 1,
@@ -100,53 +100,53 @@ module.exports = {
/**
* Require that interface names be prefixed with `I` (`interface-name` from TSLint)
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/interface-name-prefix.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/interface-name-prefix.mdx
*/
'@typescript-eslint/interface-name-prefix': 'off',
/**
* Require a consistent member declaration order (`member-ordering` from TSLint)
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.mdx
*/
'@typescript-eslint/member-ordering': 'off',
/**
* Disallow usage of the `any` type (`no-any` from TSLint)
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.mdx
*/
'@typescript-eslint/no-explicit-any': 'off',
/**
* Disallow the use of custom TypeScript modules and namespaces (`no-namespace` from TSLint)
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.mdx
*/
'@typescript-eslint/no-namespace': 'off',
/**
* Disallows non-null assertions using the `!` postfix operator (`no-non-null-assertion` from TSLint)
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.mdx
*/
'@typescript-eslint/no-non-null-assertion': 'off',
/**
* Forbids an object literal to appear in a type assertion expression (`no-object-literal-type-assertion` from TSLint)
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-object-literal-type-assertion.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-object-literal-type-assertion.mdx
*/
'@typescript-eslint/no-object-literal-type-assertion': 'off',
/**
* Disallow the use of parameter properties in class constructors. (`no-parameter-properties` from TSLint)
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.mdx
*/
'@typescript-eslint/no-parameter-properties': 'off',
/**
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.mdx
*/
'@typescript-eslint/triple-slash-reference': 'off',
/**
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-this-alias.md
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-this-alias.mdx
*/
'@typescript-eslint/no-this-alias': [
'error',
diff --git a/package.json b/package.json
index e8f4f70..07e943c 100644
--- a/package.json
+++ b/package.json
@@ -1,34 +1,30 @@
{
"name": "eslint-config-egg",
"version": "13.1.0",
- "description": "Node.js Style Guide for Egg.",
+ "engines": {
+ "node": ">= 18.19.0"
+ },
+ "description": "Node.js Style Guide for EggJS",
"main": "index",
"files": [
".eslintrc",
"index.js",
"legacy.js",
- "react.js",
"typescript.js",
"lib"
],
"dependencies": {
- "@babel/core": "^7.16.0",
- "@babel/eslint-parser": "^7.16.3",
- "@typescript-eslint/eslint-plugin": "^6.7.0",
- "@typescript-eslint/parser": "^6.7.0",
+ "@typescript-eslint/eslint-plugin": "^7.14.1",
+ "@typescript-eslint/parser": "^7.14.1",
"eslint-plugin-eggache": "^2.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^46.9.1",
- "eslint-plugin-jsx-a11y": "^6.8.0",
- "eslint-plugin-node": "^11.1.0",
- "eslint-plugin-react": "^7.33.2"
+ "eslint-plugin-node": "^11.1.0"
},
"devDependencies": {
- "@babel/preset-react": "^7.16.0",
"coffee": "^5.4.0",
"egg-bin": "6",
"eslint": "^8.3.0",
- "git-contributor": "2",
"typescript": "^5.2.2"
},
"repository": {
@@ -42,8 +38,5 @@
"test": "egg-bin test --ts false",
"ci": "npm run lint && egg-bin cov",
"contributor": "git-contributor"
- },
- "engines": {
- "node": ">= 16.0.0"
}
}
diff --git a/react.js b/react.js
deleted file mode 100644
index 02fe535..0000000
--- a/react.js
+++ /dev/null
@@ -1,17 +0,0 @@
-module.exports = {
- extends: [
- './index',
- './lib/rules/browser',
- './lib/rules/import',
- './lib/rules/react',
- './lib/rules/react-a11y',
- ].map(require.resolve),
- parser: '@babel/eslint-parser',
- rules: {},
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- experimentalObjectRestSpread: true,
- },
- },
-};
diff --git a/test/eggache.test.js b/test/eggache.test.js
index dcdac55..d7ca067 100644
--- a/test/eggache.test.js
+++ b/test/eggache.test.js
@@ -1,4 +1,4 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/eggache.test.js', () => {
diff --git a/test/enforce-node-prefix.test.js b/test/enforce-node-prefix.test.js
index 2f63ebb..19fabeb 100644
--- a/test/enforce-node-prefix.test.js
+++ b/test/enforce-node-prefix.test.js
@@ -1,4 +1,4 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/enforce-node-prefix.test.js', () => {
diff --git a/test/es2018.test.js b/test/es2018.test.js
index c26fbbb..04ab119 100644
--- a/test/es2018.test.js
+++ b/test/es2018.test.js
@@ -1,4 +1,4 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/es2018.test.js', () => {
diff --git a/test/es2020.test.js b/test/es2020.test.js
index 4fc9a7f..067c032 100644
--- a/test/es2020.test.js
+++ b/test/es2020.test.js
@@ -1,12 +1,12 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/es2020.test.js', () => {
+ const cwd = path.join(__dirname, 'fixtures/es2020');
it('should support bigint', () => {
- const cwd = path.join(__dirname, 'fixtures/es2020');
return coffee.spawn('eslint', [ 'bigint.js' ], { cwd })
- // .debug()
+ .debug()
.expect('code', 0)
.end();
});
diff --git a/test/es2022.test.js b/test/es2022.test.js
new file mode 100644
index 0000000..c00f264
--- /dev/null
+++ b/test/es2022.test.js
@@ -0,0 +1,29 @@
+const path = require('node:path');
+const coffee = require('coffee');
+
+// https://dev.to/jasmin/whats-new-in-es2022-1de6
+// Features of ES2022
+describe('test/es2022.test.js', () => {
+ const cwd = path.join(__dirname, 'fixtures/es2022');
+
+ it('should support at()', () => {
+ return coffee.spawn('eslint', [ 'at.js' ], { cwd })
+ .debug()
+ .expect('code', 0)
+ .end();
+ });
+
+ it('should support RegExp match indices', () => {
+ return coffee.spawn('eslint', [ 'regex.js' ], { cwd })
+ .debug()
+ .expect('code', 0)
+ .end();
+ });
+
+ it('should support error.cause', () => {
+ return coffee.spawn('eslint', [ 'error.js' ], { cwd })
+ .debug()
+ .expect('code', 0)
+ .end();
+ });
+});
diff --git a/test/es8.test.js b/test/es8.test.js
index 8f2b728..9842333 100644
--- a/test/es8.test.js
+++ b/test/es8.test.js
@@ -1,4 +1,4 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/es8.test.js', () => {
diff --git a/test/fixtures/enforce-node-prefix-js/.eslintrc b/test/fixtures/enforce-node-prefix-js/.eslintrc
index bf6d6de..0b96fc0 100644
--- a/test/fixtures/enforce-node-prefix-js/.eslintrc
+++ b/test/fixtures/enforce-node-prefix-js/.eslintrc
@@ -1,6 +1,5 @@
{
"extends": [
- "../../..",
- "../../../lib/rules/enforce-node-prefix"
+ "../../.."
]
}
diff --git a/test/fixtures/enforce-node-prefix/.eslintrc b/test/fixtures/enforce-node-prefix/.eslintrc
index 12278f8..756123e 100644
--- a/test/fixtures/enforce-node-prefix/.eslintrc
+++ b/test/fixtures/enforce-node-prefix/.eslintrc
@@ -1,6 +1,5 @@
{
"extends": [
- "../../../typescript",
- "../../../lib/rules/enforce-node-prefix"
+ "../../../typescript"
]
}
diff --git a/test/fixtures/es2022/.eslintrc b/test/fixtures/es2022/.eslintrc
new file mode 100644
index 0000000..a8af7d5
--- /dev/null
+++ b/test/fixtures/es2022/.eslintrc
@@ -0,0 +1,3 @@
+{
+ "extends": "../../../index.js"
+}
diff --git a/test/fixtures/es2022/at.js b/test/fixtures/es2022/at.js
new file mode 100644
index 0000000..833b7e6
--- /dev/null
+++ b/test/fixtures/es2022/at.js
@@ -0,0 +1,3 @@
+[ 1, 2, 3, 4, 5 ].at(3); // returns 4
+
+[ 1, 2, 3, 4, 5 ].at(-2); // returns 4
diff --git a/test/fixtures/es2022/error.js b/test/fixtures/es2022/error.js
new file mode 100644
index 0000000..089c499
--- /dev/null
+++ b/test/fixtures/es2022/error.js
@@ -0,0 +1,9 @@
+function readFiles() {
+ try {
+ // ยทยทยท
+ } catch (error) {
+ throw new Error('mock error', { cause: error });
+ }
+}
+
+readFiles();
diff --git a/test/fixtures/es2022/regex.js b/test/fixtures/es2022/regex.js
new file mode 100644
index 0000000..b7f85e6
--- /dev/null
+++ b/test/fixtures/es2022/regex.js
@@ -0,0 +1,4 @@
+const matchObj = /(a+)(b+)/d.exec('aaaabb');
+
+console.log(matchObj);
+matchObj.indices[1];
diff --git a/test/fixtures/node-app/no-new-require-fail.js b/test/fixtures/node-app/no-new-require-fail.js
index 15f62a3..cd407b9 100644
--- a/test/fixtures/node-app/no-new-require-fail.js
+++ b/test/fixtures/node-app/no-new-require-fail.js
@@ -1,4 +1,4 @@
'use strict';
-const fs = new require('fs');
+const fs = new require('node:fs');
console.log(fs);
diff --git a/test/fixtures/node-app/no-new-require.js b/test/fixtures/node-app/no-new-require.js
index 031b40e..73168c8 100644
--- a/test/fixtures/node-app/no-new-require.js
+++ b/test/fixtures/node-app/no-new-require.js
@@ -1,4 +1,4 @@
'use strict';
-const fs = require('fs');
+const fs = require('node:fs');
console.log(fs);
diff --git a/test/fixtures/node-app/prefer-global-fail.js b/test/fixtures/node-app/prefer-global-fail.js
index f785dcc..20994c9 100644
--- a/test/fixtures/node-app/prefer-global-fail.js
+++ b/test/fixtures/node-app/prefer-global-fail.js
@@ -1,22 +1,22 @@
'use strict';
-const { Buffer } = require('buffer');
+const { Buffer } = require('node:buffer');
Buffer.alloc(16);
-const console = require('console');
+const console = require('node:console');
console.log('hello');
-const process = require('process');
+const process = require('node:process');
process.exit(0);
-const { TextDecoder } = require('util');
+const { TextDecoder } = require('node:util');
new TextDecoder();
-const { TextEncoder } = require('util');
-new TextEncoder()
+const { TextEncoder } = require('node:util');
+new TextEncoder();
-const { URLSearchParams } = require('url');
+const { URLSearchParams } = require('node:url');
new URLSearchParams();
-const { URL } = require('url');
+const { URL } = require('node:url');
new URL();
diff --git a/test/fixtures/node-app/prefer-promises-fail.js b/test/fixtures/node-app/prefer-promises-fail.js
index f6a9071..2202172 100644
--- a/test/fixtures/node-app/prefer-promises-fail.js
+++ b/test/fixtures/node-app/prefer-promises-fail.js
@@ -1,7 +1,7 @@
'use strict';
-const dns = require('dns');
-const fs = require('fs');
+const dns = require('node:dns');
+const fs = require('node:fs');
() => {
fs.readFile('./.eslintrc', 'utf8', (error, content) => {
diff --git a/test/fixtures/node-app/prefer-promises.js b/test/fixtures/node-app/prefer-promises.js
index 2a57d6d..4555cdd 100644
--- a/test/fixtures/node-app/prefer-promises.js
+++ b/test/fixtures/node-app/prefer-promises.js
@@ -1,7 +1,7 @@
'use strict';
-const { promises: dns } = require('dns');
-const { promises: fs } = require('fs');
+const { promises: dns } = require('node:dns');
+const { promises: fs } = require('node:fs');
const readFile = async filePath => {
const content = await fs.readFile(filePath, 'utf8');
diff --git a/test/fixtures/react-app/.eslintrc b/test/fixtures/react-app/.eslintrc
deleted file mode 100644
index fca05fd..0000000
--- a/test/fixtures/react-app/.eslintrc
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "../../../react.js"
-}
diff --git a/test/fixtures/react-app/a11y/anchor-is-valid-error.jsx b/test/fixtures/react-app/a11y/anchor-is-valid-error.jsx
deleted file mode 100644
index d1484a8..0000000
--- a/test/fixtures/react-app/a11y/anchor-is-valid-error.jsx
+++ /dev/null
@@ -1,3 +0,0 @@
-import React from 'react';
-
-();
diff --git a/test/fixtures/react-app/a11y/no-distracting-elements-marquee-error.jsx b/test/fixtures/react-app/a11y/no-distracting-elements-marquee-error.jsx
deleted file mode 100644
index 4d2c974..0000000
--- a/test/fixtures/react-app/a11y/no-distracting-elements-marquee-error.jsx
+++ /dev/null
@@ -1,3 +0,0 @@
-import React from 'react';
-
-();
diff --git a/test/fixtures/react-app/babel.config.json b/test/fixtures/react-app/babel.config.json
deleted file mode 100644
index 8f7d571..0000000
--- a/test/fixtures/react-app/babel.config.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "presets": [
- "@babel/preset-react"
- ]
-}
diff --git a/test/fixtures/react-app/browser.js b/test/fixtures/react-app/browser.js
deleted file mode 100644
index ae32195..0000000
--- a/test/fixtures/react-app/browser.js
+++ /dev/null
@@ -1 +0,0 @@
-console.log(name);
diff --git a/test/fixtures/react-app/forbid-prop-types.jsx b/test/fixtures/react-app/forbid-prop-types.jsx
deleted file mode 100644
index dbba6e7..0000000
--- a/test/fixtures/react-app/forbid-prop-types.jsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-
-class Home extends React.Component {
- render() {
- return { this.props.children } ;
- }
-}
-
-Home.propTypes = {
- children: PropTypes.object,
-};
-
-export default Home;
diff --git a/test/fixtures/react-app/jsx.jsx b/test/fixtures/react-app/jsx.jsx
deleted file mode 100644
index 774081b..0000000
--- a/test/fixtures/react-app/jsx.jsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import ReactDOM from 'react-dom';
-import React from 'react';
-
-class HelloMessage extends React.Component {
- render() {
- return Hello {this.props.name} ;
- }
-}
-
-HelloMessage.defaultProps = {
- name: '',
-};
-HelloMessage.propTypes = {
- name: React.PropTypes.string,
-};
-
-ReactDOM.render(
- ,
- document.getElementById('container')
-);
diff --git a/test/index.test.js b/test/index.test.js
index d72ca61..9b830bf 100644
--- a/test/index.test.js
+++ b/test/index.test.js
@@ -1,4 +1,4 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/index.test.js', () => {
diff --git a/test/jsdoc.test.js b/test/jsdoc.test.js
index d275418..befefd3 100644
--- a/test/jsdoc.test.js
+++ b/test/jsdoc.test.js
@@ -1,10 +1,10 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/jsdoc.test.js', () => {
const cwd = path.join(__dirname, 'fixtures/jsdoc-app');
- it('should warnning when function params is not exist', () => {
+ it('should warning when function params is not exist', () => {
return coffee.spawn('eslint', [ 'index.js' ], { cwd })
// .debug()
.expect('stdout', /warning {2}Missing JSDoc @param "abc" declaration/)
diff --git a/test/legacy.test.js b/test/legacy.test.js
index 23e7b5e..e68b574 100644
--- a/test/legacy.test.js
+++ b/test/legacy.test.js
@@ -1,4 +1,4 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/legacy.test.js', () => {
diff --git a/test/node.test.js b/test/node.test.js
index f83ca7f..c8d8b7d 100644
--- a/test/node.test.js
+++ b/test/node.test.js
@@ -1,4 +1,4 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/node.test.js', () => {
@@ -26,11 +26,13 @@ describe('test/node.test.js', () => {
.end();
});
- it('should fail with unused promises', () => {
+ // not support node: prefix
+ it.skip('should fail with unused promises', () => {
return coffee.spawn('eslint', [ 'prefer-promises-fail.js' ], { cwd })
.expect('stdout', /node\/prefer-promises\/fs/)
.expect('stdout', /node\/prefer-promises\/dns/)
.expect('code', 0)
+ .debug()
.end();
});
});
@@ -42,12 +44,14 @@ describe('test/node.test.js', () => {
.end();
});
- it('should fail with unused the global variable', () => {
+ // not support node: prefix
+ it.skip('should fail with unused the global variable', () => {
return coffee.spawn('eslint', [ 'prefer-global-fail.js' ], { cwd })
.expect('stdout', /prefer-global\/buffer/)
.expect('stdout', /prefer-global\/console/)
.expect('stdout', /prefer-global\/process/)
.expect('code', 1)
+ .debug()
.end();
});
});
diff --git a/test/react.test.js b/test/react.test.js
deleted file mode 100644
index 3e46874..0000000
--- a/test/react.test.js
+++ /dev/null
@@ -1,51 +0,0 @@
-const path = require('path');
-const coffee = require('coffee');
-
-describe('test/react.test.js', () => {
-
- it('should support jsx', () => {
- const cwd = path.join(__dirname, 'fixtures/react-app');
- return coffee.spawn('eslint', [ 'jsx.jsx' ], { cwd })
- // .debug()
- .expect('code', 0)
- .end();
- });
-
- it('should disable forbid-prop-types', () => {
- const cwd = path.join(__dirname, 'fixtures/react-app');
- return coffee.spawn('eslint', [ 'forbid-prop-types.jsx' ], { cwd })
- // .debug()
- .expect('code', 0)
- .end();
- });
-
- describe('a11y', () => {
- it('should error with no-distracting-elements', () => {
- const cwd = path.join(__dirname, 'fixtures/react-app');
- return coffee.spawn('eslint', [ 'a11y/no-distracting-elements-marquee-error.jsx' ], { cwd })
- // .debug()
- .expect('stdout', /jsx-a11y\/no-distracting-elements/)
- .expect('code', 1)
- .end();
- });
-
- it('should error with anchor-is-valid', () => {
- const cwd = path.join(__dirname, 'fixtures/react-app');
- return coffee.spawn('eslint', [ 'a11y/anchor-is-valid-error.jsx' ], { cwd })
- // .debug()
- .expect('stdout', /jsx-a11y\/anchor-is-valid/)
- .expect('code', 1)
- .end();
- });
- });
-
- describe('browser', () => {
- it('should be enable', () => {
- const cwd = path.join(__dirname, 'fixtures/react-app');
- return coffee.spawn('eslint', [ 'browser.js' ], { cwd })
- // .debug()
- .expect('code', 0)
- .end();
- });
- });
-});
diff --git a/test/ts.test.js b/test/ts.test.js
index 363c03f..41e112d 100644
--- a/test/ts.test.js
+++ b/test/ts.test.js
@@ -1,4 +1,4 @@
-const path = require('path');
+const path = require('node:path');
const coffee = require('coffee');
describe('test/ts.test.js', () => {
|