Skip to content

Commit

Permalink
feat: add types for the configuration's default export (#147)
Browse files Browse the repository at this point in the history
* Update config-generator.js

* updated snapshots
  • Loading branch information
amirfarzamnia authored Oct 11, 2024
1 parent 602a7ab commit 2eaacd0
Show file tree
Hide file tree
Showing 43 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug

this.result.configContent = `${importContent}
${needCompatHelper ? helperContent : ""}
/** @type {import('eslint').Linter.Config[]} */
export default [\n${exportContent}];`;
}

Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-airbnb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended});

/** @type {import('eslint').Linter.Config[]} */
export default [
...compat.extends("airbnb"),
];",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-airbnb-base
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended});

/** @type {import('eslint').Linter.Config[]} */
export default [
...compat.extends("airbnb-base"),
];",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-standard
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended});

/** @type {import('eslint').Linter.Config[]} */
export default [
...compat.extends("standard"),
];",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-standard-flat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"configContent": "import config from "eslint-config-standard";


/** @type {import('eslint').Linter.Config[]} */
export default [
...[].concat(config),
];",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-standard-flat2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"configContent": "import config from "eslint-config-standard";


/** @type {import('eslint').Linter.Config[]} */
export default [
...[].concat(config),
];",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-xo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"configContent": "import config from "eslint-config-xo";


/** @type {import('eslint').Linter.Config[]} */
export default [
...[].concat(config),
];",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-commonjs-none-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pluginJs from "@eslint/js";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-commonjs-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-commonjs-react-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import pluginJs from "@eslint/js";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,jsx}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-commonjs-react-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-commonjs-vue-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import pluginJs from "@eslint/js";
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,vue}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-commonjs-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,vue}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-esm-none-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pluginJs from "@eslint/js";


/** @type {import('eslint').Linter.Config[]} */
export default [
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
pluginJs.configs.recommended,
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-esm-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-esm-react-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import pluginJs from "@eslint/js";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,jsx}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-esm-react-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-esm-vue-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import pluginJs from "@eslint/js";
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,vue}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-esm-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,vue}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-script-none-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pluginJs from "@eslint/js";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-script-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-script-react-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import pluginJs from "@eslint/js";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,jsx}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-script-react-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-script-vue-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import pluginJs from "@eslint/js";
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,vue}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-script-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,vue}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-commonjs-none-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"configContent": "import globals from "globals";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-commonjs-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-commonjs-react-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,jsx}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-commonjs-react-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-commonjs-vue-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,vue}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-commonjs-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,vue}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-esm-none-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"configContent": "import globals from "globals";


/** @type {import('eslint').Linter.Config[]} */
export default [
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
];",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-esm-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-esm-react-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,jsx}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-esm-react-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-esm-vue-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,vue}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-esm-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,vue}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-script-none-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"configContent": "import globals from "globals";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-script-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-script-react-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,jsx}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-script-react-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-script-vue-javascript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,vue}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-script-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,vue}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "script"}},
Expand Down

0 comments on commit 2eaacd0

Please sign in to comment.