From 8c88ce7a318b1782ef35e32dbe99898af2ecbf17 Mon Sep 17 00:00:00 2001 From: Carl Markham Date: Fri, 14 Feb 2025 01:57:27 +0000 Subject: [PATCH 1/2] remove prettier, use eslint stylistic --- .prettierrc.json | 8 -------- eslint.config.mjs | 43 +++++-------------------------------------- package-lock.json | 42 +++++++++++++++++++++++++++++++++++++----- package.json | 4 +--- 4 files changed, 43 insertions(+), 54 deletions(-) delete mode 100644 .prettierrc.json diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 6d2d594..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "trailingComma": "all", - "tabWidth": 2, - "semi": false, - "singleQuote": true, - "useTabs": false, - "printWidth": 120 -} diff --git a/eslint.config.mjs b/eslint.config.mjs index 177e65d..8e81b82 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -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', }, }, ] diff --git a/package-lock.json b/package-lock.json index a9a9f5b..efbacd7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gherklin", - "version": "1.0.5", + "version": "1.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gherklin", - "version": "1.0.5", + "version": "1.0.7", "license": "ISC", "dependencies": { "@cucumber/gherkin": "^30.0.4", @@ -21,8 +21,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", @@ -37,7 +36,6 @@ "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", @@ -1394,6 +1392,39 @@ "integrity": "sha512-DE427ROAphMQzU4ENbliGYrBSYPXF+TtLg9S8vzeA+OF4ZKzoDdzfL8sxuMUGS/lgRhM6j1URSk9ghf7Xo1tyA==", "dev": true }, + "node_modules/@stylistic/eslint-plugin": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-3.1.0.tgz", + "integrity": "sha512-pA6VOrOqk0+S8toJYhQGv2MWpQQR0QpeUo9AhNkC49Y26nxBQ/nH1rta9bUU1rPw2fJ1zZEMV5oCX5AazT7J2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/utils": "^8.13.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "estraverse": "^5.3.0", + "picomatch": "^4.0.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@stylistic/eslint-plugin/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@teppeis/multimaps": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@teppeis/multimaps/-/multimaps-3.0.0.tgz", @@ -4106,6 +4137,7 @@ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", "dev": true, + "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, diff --git a/package.json b/package.json index d082dc2..bf7787f 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,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", @@ -58,7 +57,6 @@ "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", From 11117324f803d71d51f884180971ba0053d42652 Mon Sep 17 00:00:00 2001 From: Carl Markham Date: Fri, 14 Feb 2025 02:00:36 +0000 Subject: [PATCH 2/2] remove prettier, use eslint stylistic --- .github/workflows/linting.yml | 2 +- CONTRIBUTING.md | 3 +-- README.md | 3 --- package.json | 4 ---- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 1bed435..ccbb7b3 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f99d86d..b4f49f1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/README.md b/README.md index d33c713..a90489d 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,6 @@ - - - npm version diff --git a/package.json b/package.json index bf7787f..aba2e43 100644 --- a/package.json +++ b/package.json @@ -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": { @@ -52,8 +50,6 @@ "@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",