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

MOL-29362: fix ESlint 9 BREAKING CHANGES #60

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ node_modules
!.husky
!.gitignore
!.npmignore
!.travis.yml
package-lock.json
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint && npm run test && npm run format
npm run lint && npm run test
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

73 changes: 34 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
# `eslint-config-mailonline`

[![Greenkeeper badge](https://badges.greenkeeper.io/MailOnline/eslint-config-mailonline.svg)](https://greenkeeper.io/)

[![NPM version](http://img.shields.io/npm/v/eslint-config-mailonline.svg?style=flat-square)](https://www.npmjs.org/package/eslint-config-mailonline)
[![Travis build status](http://img.shields.io/travis/MailOnline/eslint-config-mailonline/master.svg?style=flat-square)](https://travis-ci.org/MailOnline/eslint-config-mailonline)

MailOnline ESLint configuration.
`eslint-config-mailonline` is a shared ESLint configuration used by MailOnline. This configuration includes rules for ES6, React, Jest, Lodash, and Webpack.

## Usage
## Prerequisites

- Node.js v18.18 or higher

## Installation

Add `eslint-config-mailonline` as a development dependency:

For *npm* users:
```bash
npm install eslint-config-mailonline --save-dev
```

Create ESLint configuration file (`.eslintrc`) that extends `eslint-config-mailonline`:
For *Yarn* users:
```bash
yarn add eslint-config-mailonline --dev
```

```json
Please note that there is no requirement to install stylelint independently in the parent package. This is because it is included as a dependency within this library and will be hoisted to the parent package.

## Usage

Create ESLint configuration file (`eslint.json`) that extends `eslint-config-mailonline`:

```js
{
"extends": "mailonline"
"extends": "mailonline",
}
```

Expand All @@ -28,62 +39,46 @@ Create ESLint configuration file (`.eslintrc`) that extends `eslint-config-mailo
The package also has separate entry points for some environments. Simply extend from the entry point as described below,
either in a folder-specific eslint config, or additionally to the root config, e.g.:

```json
{
```js
module.exports = {
"extends": [
"mailonline",
"mailonline/jest",
"mailonline/react"
]
}
};
```

### jest

```json
{
```js
module.exports = {
"extends": "mailonline/jest"
}
```

### mocha

```json
{
"extends": "mailonline/mocha"
}
};
```

### react

```json
{
```js
module.exports = {
"extends": "mailonline/react"
}
```

### flowtype

```json
{
"extends": "mailonline/flowtype"
}
};
```

### lodash

```json
{
```js
module.exports = {
"extends": "mailonline/lodash"
}
};
```

### webpack

```json
{
```js
module.exports = {
"extends": "mailonline/webpack"
}
};
```

## Breaking changes
Expand Down
17 changes: 5 additions & 12 deletions configurations/base.json → configurations/base.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "babel-eslint",
"parser": "espree", // default one: https://eslint.org/docs/v8.x/use/configure/parser
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"globalReturn": false,
"impliedStrict": true,
"jsx": true
},
"ecmaVersion": 2017,
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": [
Expand Down Expand Up @@ -166,10 +166,7 @@
"json": "always"
}
],
"import/first": [
2,
"absolute-first"
],
"import/first": 2,
"import/max-dependencies": 0,
"import/named": 2,
"import/namespace": 2,
Expand Down Expand Up @@ -234,10 +231,6 @@
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": [
1,
"always"
],
"jsdoc/require-description-complete-sentence": 1,
"jsdoc/require-hyphen-before-description": 0,
"jsdoc/require-param": 0,
Expand Down Expand Up @@ -658,4 +651,4 @@
".js"
]
}
}
};
61 changes: 0 additions & 61 deletions configurations/flowtype.json

This file was deleted.

4 changes: 2 additions & 2 deletions configurations/jest.json → configurations/jest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
module.exports = {
"env": {
"jest": true
},
Expand All @@ -11,4 +11,4 @@
"jest/no-identical-title": "error",
"jest/valid-expect": "error"
}
}
};
4 changes: 2 additions & 2 deletions configurations/lodash.json → configurations/lodash.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
module.exports = {
"plugins": [
"lodash"
],
Expand Down Expand Up @@ -65,4 +65,4 @@
"lodash/prop-shorthand": 1,
"lodash/unwrap": 1
}
}
};
22 changes: 0 additions & 22 deletions configurations/mocha.json

This file was deleted.

4 changes: 2 additions & 2 deletions configurations/react.json → configurations/react.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
module.exports = {
"plugins": [
"react"
],
Expand Down Expand Up @@ -104,4 +104,4 @@
"react/style-prop-object": 2,
"react/void-dom-elements-no-children": 2
}
}
};
4 changes: 2 additions & 2 deletions configurations/webpack.json → configurations/webpack.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
module.exports = {
"settings": {
"import/resolver": "webpack"
}
}
};
1 change: 0 additions & 1 deletion flowtype.js

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./configurations/base.json');
module.exports = require('./configurations/base');
2 changes: 1 addition & 1 deletion jest.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./configurations/jest.json');
module.exports = require('./configurations/jest');
2 changes: 1 addition & 1 deletion lodash.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./configurations/lodash.json');
module.exports = require('./configurations/lodash');
1 change: 0 additions & 1 deletion mocha.js

This file was deleted.

12 changes: 2 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,24 @@
"eslint-import-resolver-webpack": "^0.13.8"
},
"dependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^8.57.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-jsdoc": "^48.2.3",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-mocha": "^10.4.2",
"eslint-plugin-no-use-extend-native": "^0.5.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-unicorn": "^52.0.0"
},
"devDependencies": {
"eslint": "^9.0.0",
"husky": "^7.0.2",
"jsonlint": "^1.6.3",
"semantic-release": "^22.0.12"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"eslint": "^7.32.0"
"node": ">=18.18"
},
"keywords": [
"eslint",
Expand All @@ -47,7 +40,6 @@
"url": "https://github.com/mailonline/eslint-config-mailonline"
},
"scripts": {
"format": "jsonlint --sort-keys --in-place --indent ' ' ./configurations/*.json",
"lint": "echo 'This project has no linting' && exit 0",
"prepare": "husky install",
"semantic-release": "semantic-release",
Expand Down
2 changes: 1 addition & 1 deletion react.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./configurations/react.json');
module.exports = require('./configurations/react');
2 changes: 1 addition & 1 deletion webpack.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./configurations/webpack.json');
module.exports = require('./configurations/webpack');
Loading
Loading