Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CommonJS ESLint configuration #267

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/commonjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

[Unreleased]: https://github.com/MetaMask/eslint-config/
21 changes: 21 additions & 0 deletions packages/commonjs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 MetaMask

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 32 additions & 0 deletions packages/commonjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# `@metamask/eslint-config-commonjs`

MetaMask's ESLint configuration for projects using CommonJS.

## Usage

```bash
yarn add --dev \
@metamask/eslint-config@^11.0.1 \
@metamask/eslint-config-commonjs@^11.0.2 \
eslint@^8.27.0 \
eslint-config-prettier@^8.5.0 \
eslint-plugin-import@^2.26.0 \
eslint-plugin-jsdoc@^39.6.2 \
eslint-plugin-prettier@^4.2.1 \
prettier@^2.7.1
```

The order in which you extend ESLint rules matters.
The `@metamask/*` eslint configs should be added to the `extends` array _last_,
with `@metamask/eslint-config` first, and `@metamask/eslint-config-*` in any
order thereafter.

```js
module.exports = {
extends: [
// This should be added last unless you know what you're doing.
'@metamask/eslint-config',
'@metamask/eslint-config-commonjs',
],
};
```
5 changes: 5 additions & 0 deletions packages/commonjs/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const packageJson = require('./package.json');

module.exports = {
displayName: packageJson.name,
};
48 changes: 48 additions & 0 deletions packages/commonjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "@metamask/eslint-config-commonjs",
"version": "11.0.2",
"description": "Shareable MetaMask ESLint config for CommonJS projects.",
"homepage": "https://github.com/MetaMask/eslint-config#readme",
"bugs": {
"url": "https://github.com/MetaMask/eslint-config/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/eslint-config.git"
},
"license": "MIT",
"main": "src/index.js",
"files": [
"src/",
"!src/**/*.test.js"
],
"scripts": {
"lint:changelog": "auto-changelog validate",
"publish": "npm publish",
"test": "eslint ."
},
"devDependencies": {
"@metamask/auto-changelog": "^3.0.0",
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.6.2",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1"
},
"peerDependencies": {
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.6.2",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1"
},
"engines": {
"node": ">=14.0.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}