Skip to content
New issue

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

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

Already on GitHub? # to your account

Remove prettier in favour of eslint stylistic #128

Merged
merged 2 commits into from
Feb 14, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
- name: Install Dependencies
run: npm ci
- name: Run TypeScript Linting
run: npm run eslint && npm run prettier
run: npm run eslint
8 changes: 0 additions & 8 deletions .prettierrc.json

This file was deleted.

3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ Tests are written using [Mocha](https://mochajs.org/), with [Sinon](https://sino
Each new rule must have acceptance tests.

# Pull Requests
Gherklin uses [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/) for code formatting. It may be useful
Gherklin uses [ESLint](https://eslint.org/) for code formatting. It may be useful
to set up your IDE to automatically format on save.

You can also run the following if that is not an option:
```shell
npm run eslint:fix
npm run prettier:fix
```

Please be as descriptive as possible in your PR description, mentioning any issue(s) that are resolved by your PR.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
<a href="https://github.com/cjmarkham/Gherklin/actions/workflows/linting.yml">
<img src="https://github.com/cjmarkham/gherkin-lint/actions/workflows/linting.yml/badge.svg">
</a>
<a href="https://github.com/prettier/prettier/tree/c067d27673c6d97d9037eb9b13b74bd8c9324be2?tab=readme-ov-file#badge">
<img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg">
</a>
<a href="https://www.npmjs.com/package/gherklin">
<img alt="npm version" src="https://img.shields.io/npm/v/gherklin.svg">
</a>
Expand Down
43 changes: 5 additions & 38 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,58 +1,25 @@
import stylistic from '@stylistic/eslint-plugin'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
...compat.extends('prettier'),
{
name: 'Default configuration',
files: ['src/**/*.ts'],
plugins: {
'@typescript-eslint': typescriptEslint,
'@stylistic': stylistic,
},

languageOptions: {
globals: {
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, 'off'])),
},

parser: tsParser,
ecmaVersion: 12,
sourceType: 'module',
},

settings: {
'import/resolver': {
node: {
extensions: ['.ts'],
},
},
},

rules: {
'no-template-curly-in-string': 'off',
'no-useless-constructor': 'off',
'max-len': 'off',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@stylistic/eol-last': 'warn',
'@stylistic/max-len': ['warn', { code: 80 }],
'@stylistic/comma-dangle': ['warn', 'always-multiline'],
'class-methods-use-this': 'off',
'@typescript-eslint/explicit-function-return-type': 'error',
'consistent-return': 'off',
'prefer-destructuring': 'off',
},
},
]
42 changes: 37 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"acceptance": "NODE_OPTIONS=--import=tsx ./node_modules/.bin/cucumber-js --config tests/acceptance/cucumber.mjs",
"eslint": "node_modules/.bin/eslint",
"eslint:fix": "node_modules/.bin/eslint --fix",
"prettier": "node_modules/.bin/prettier --check src/**/*.ts",
"prettier:fix": "node_modules/.bin/prettier --check src/**/*.ts --write",
"gherklin": "npx tsx ./bin/gherklin"
},
"engines": {
Expand Down Expand Up @@ -42,8 +40,7 @@
},
"devDependencies": {
"@cucumber/cucumber": "^11.0.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.9.0",
"@stylistic/eslint-plugin": "^3.1.0",
"@types/chai": "^5.0.0",
"@types/chai-as-promised": "^8.0.0",
"@types/mocha": "^10.0.7",
Expand All @@ -53,12 +50,9 @@
"@typescript-eslint/parser": "^8.2.0",
"chai-as-promised": "^8.0.0",
"eslint": "^9.9.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-prettier": "^5.2.1",
"gherklin": "./",
"globals": "^15.9.0",
"mocha": "^10.7.3",
"prettier": "^3.3.3",
"sinon": "^19.0.2",
"tsx": "^4.19.1",
"typescript": "^5.5.4",
Expand Down
Loading