Skip to content

Commit

Permalink
feat: update ESLint to v9
Browse files Browse the repository at this point in the history
BREAKING CHANGE: due to the upgrade of various ESLint plugins, the minimum supported version
TypeScript and Node.js has been increased. This should not affect most users, but if you are using
an older version of TypeScript or Node.js, you may need to upgrade.
Furthermore some of the dependencies have been updated to their latest versions, which may cause
some checks to fail.
  • Loading branch information
mfeltscher committed Dec 4, 2024
1 parent b1f3122 commit a890939
Show file tree
Hide file tree
Showing 14 changed files with 248 additions and 172 deletions.
56 changes: 0 additions & 56 deletions .eslintrc.js

This file was deleted.

30 changes: 0 additions & 30 deletions .eslintrc.react.js

This file was deleted.

9 changes: 8 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v4'
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '22.x'
- run: npm install
- run: npm run build
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
Expand Down
46 changes: 3 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,20 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# NPM lock file
package-lock.json

# Distribution directory
dist
8 changes: 0 additions & 8 deletions .npmignore

This file was deleted.

30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,28 @@ $ npm install eslint @smartive/eslint-config -D

## Usage

Create a `.eslintrc` file in the root of your project's directory (it should live where `package.json` does). This package offers two different rulesets, on for plain TypeScript applications (`@smartive/eslint-config`) and a separate one for React applications (`@smartive/eslint-config`). Your `.eslintrc` file should look like this:
This package offers two different rule sets, one for plain TypeScript applications and a separate one for React applications.

### Plain TypeScript applications
### Flat Config (`eslint.config.mjs`)

```
{
"extends": [
"@smartive/eslint-config"
]
}
```
```javascript
import { configs } from '@smartive/eslint-config'

### React applications
// For plain TS applications ..
export default configs.typescript;

// .. or React applications
export default configs.react;
```

### Legacy Config (`.eslintrc`)

```json
{
"extends": [
"@smartive/eslint-config/react"
"@smartive/eslint-config/typescript-legacy" // Plain TS applications
// or
"@smartive/eslint-config/react-legacy" // React applications
]
}
```
Expand All @@ -42,7 +46,3 @@ To use eslint add the following to your package.json:
"lint:fix": "eslint . --fix"
}
```

### TypeScript configuration

Since there are some rules which require type information please make sure to set up a `tsconfig.json` configuration file in the root directory of your project. If your TypeScript configuration file is placed in another location you have to configure it using `parserOptions.project` in your ESLint configuration file. For more information have a look at the [typescript-eslint documentation](https://typescript-eslint.io/packages/parser/#project).
3 changes: 0 additions & 3 deletions index.js

This file was deleted.

56 changes: 43 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,26 @@
"name": "@smartive/eslint-config",
"version": "0.0.0-development",
"description": "ESLint configuration by smartive",
"main": "index.js",
"files": [
"README.md",
"LICENSE",
"dist"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
},
"./react-legacy": {
"import": "./dist/esm/react-legacy.js",
"require": "./dist/cjs/react-legacy.js"
},
"./typescript-legacy": {
"import": "./dist/esm/typescript-legacy.js",
"require": "./dist/cjs/typescript-legacy.js"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/smartive/eslint-config.git"
Expand All @@ -20,26 +39,37 @@
},
"homepage": "https://github.com/smartive/eslint-config#readme",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": ">=4.0.0 <6",
"eslint-plugin-react": "^7.27.0",
"eslint-plugin-react-hooks": "^4.3.0"
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"globals": "^15.13.0",
"typescript-eslint": "^8.15.0"
},
"peerDependencies": {
"eslint": "^8.0.0"
"eslint": "^8.57.0 || ^9.0.0"
},
"devDependencies": {
"@commitlint/cli": "^19.0.0",
"@commitlint/config-conventional": "^19.0.0",
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"@eslint/js": "^9.15.0",
"@smartive/prettier-config": "^3.0.0",
"@types/node": "^22.9.1",
"cz-conventional-changelog": "^3.3.0",
"husky": "^9.0.0",
"prettier": "^3.0.0"
"esbuild": "0.24.0",
"eslint": "^9.15.0",
"husky": "^9.1.7",
"prettier": "^3.3.3",
"typescript": "^5.6.3"
},
"scripts": {
"build:types": "tsc --declaration --emitDeclarationOnly",
"build:cjs": "esbuild --platform=browser --format=cjs --outdir=dist/cjs/ ./src/*.ts",
"build:mjs": "esbuild --platform=neutral --format=esm --outdir=dist/esm/ ./src/*.ts",
"build": "rm -rf dist && npm run build:cjs && npm run build:mjs && npm run build:types",
"commitlint": "commitlint --edit",
"prepare": "[ ! -f node_modules/.bin/husky ] || husky"
},
Expand Down
3 changes: 0 additions & 3 deletions react.js

This file was deleted.

Loading

0 comments on commit a890939

Please sign in to comment.