diff --git a/packages/eslint-config-airbnb-base/flat.js b/packages/eslint-config-airbnb-base/flat.js new file mode 100644 index 0000000000..6ec64e0c68 --- /dev/null +++ b/packages/eslint-config-airbnb-base/flat.js @@ -0,0 +1,19 @@ +const bestPractices = require('./rules/best-practices'); +const errors = require('./rules/errors'); +const node = require('./rules/flat/node'); +const style = require('./rules/style'); +const variables = require('./rules/variables'); +const es6 = require('./rules/flat/es6'); +const imports = require('./rules/flat/imports'); +const strict = require('./rules/strict'); + +module.exports = [ + bestPractices, + errors, + node, + style, + variables, + es6, + imports, + strict, +]; diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index 8f039d4d7c..f4e1e04499 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -5,6 +5,7 @@ "main": "index.js", "exports": { ".": "./index.js", + "./flat": "./flat.js", "./legacy": "./legacy.js", "./whitespace": "./whitespace.js", "./rules/best-practices": "./rules/best-practices.js", @@ -87,6 +88,7 @@ "node": "^10.12.0 || >=12.0.0" }, "dependencies": { - "confusing-browser-globals": "^1.0.11" + "confusing-browser-globals": "^1.0.11", + "globals": "^15.12.0" } } diff --git a/packages/eslint-config-airbnb-base/rules/flat/es6.js b/packages/eslint-config-airbnb-base/rules/flat/es6.js new file mode 100644 index 0000000000..38b94171cd --- /dev/null +++ b/packages/eslint-config-airbnb-base/rules/flat/es6.js @@ -0,0 +1,12 @@ +const es6 = require('../es6'); +const globals = require('globals'); + +module.exports = { + languageOptions: { + globals: { + ...globals.es2015, + }, + parserOptions: es6.parserOptions, + }, + rules: es6.rules, +}; diff --git a/packages/eslint-config-airbnb-base/rules/flat/imports.js b/packages/eslint-config-airbnb-base/rules/flat/imports.js new file mode 100644 index 0000000000..3185a4cfd1 --- /dev/null +++ b/packages/eslint-config-airbnb-base/rules/flat/imports.js @@ -0,0 +1,13 @@ +const importPlugin = require('eslint-plugin-import'); +const imports = require('../imports'); + +module.exports = { + languageOptions: { + parserOptions: imports.parserOptions, + }, + plugins: { + import: importPlugin + }, + settings: imports.settings, + rules: imports.rules, +}; diff --git a/packages/eslint-config-airbnb-base/rules/flat/node.js b/packages/eslint-config-airbnb-base/rules/flat/node.js new file mode 100644 index 0000000000..4c63b14abc --- /dev/null +++ b/packages/eslint-config-airbnb-base/rules/flat/node.js @@ -0,0 +1,11 @@ +const globals = require('globals'); +const node = require('../node'); + +module.exports = { + languageOptions: { + globals: { + ...globals.es2015, + } + }, + rules: node.rules, +};