Skip to content

Commit

Permalink
Convert base config to flat config format
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz committed Sep 22, 2024
1 parent 8d7f1cb commit 5c9d1f8
Show file tree
Hide file tree
Showing 15 changed files with 812 additions and 428 deletions.
19 changes: 17 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
// @ts-check

// @ts-expect-error - `@babel/eslint-parser` doesn't have TypeScript types.
import babel from '@babel/eslint-parser';
import baseConfigs from '@metamask/eslint-config';

/**
* @type {import('eslint').Linter.Config[]}
*/
const config = [
...baseConfigs,
// TODO:
// extends: [
// '@metamask/eslint-config',
// '@metamask/eslint-config-nodejs',
// '@metamask/eslint-config-jest',
// ],

{
name: 'main',
languageOptions: {
ecmaVersion: 2022,

sourceType: 'module',

parser: babel,
parserOptions: {
requireConfigFile: false,
babelOptions: {
plugins: ['@babel/plugin-syntax-import-attributes'],
},
},
},

rules: {
Expand All @@ -26,7 +41,7 @@ const config = [
},

ignores: ['!.eslint.config.mjs'],
}
},
];

export default config;
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
"test": "jest"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@babel/plugin-syntax-import-attributes": "^7.25.6",
"@eslint/js": "^9.11.0",
"@jest/globals": "^29.7.0",
"@lavamoat/allow-scripts": "^3.0.4",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^13.0.0",
Expand Down
5 changes: 0 additions & 5 deletions packages/base/jest.config.js

This file was deleted.

17 changes: 16 additions & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@
"type": "git",
"url": "https://github.com/MetaMask/eslint-config.git"
},
"type": "module",
"license": "MIT",
"main": "src/index.js",
"main": "./src/index.mjs",
"types": "./src/index.d.mts",
"exports": {
".": {
"import": {
"types": "./src/index.d.mts",
"default": "./src/index.mjs"
}
}
},
"files": [
"src/",
"!src/**/*.test.js"
Expand All @@ -22,6 +32,7 @@
"test": "eslint ."
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@metamask/auto-changelog": "^3.4.4",
"eslint": "^9.11.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -46,5 +57,9 @@
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"@eslint/js": "^9.11.0",
"globals": "^15.9.0"
}
}
6 changes: 6 additions & 0 deletions packages/base/src/index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '@metamask/eslint-config' {
import { Linter } from 'eslint';

const config: Linter.Config[];
export default config;
}
Loading

0 comments on commit 5c9d1f8

Please sign in to comment.