Skip to content

Commit

Permalink
test: use ESLint v9 in examples (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic authored Jul 23, 2024
1 parent e0da221 commit 923e440
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 30 deletions.
3 changes: 2 additions & 1 deletion examples/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ function App({ name }) {

```sh
$ git clone https://github.com/eslint/eslint-plugin-markdown.git
$ cd eslint-plugin-markdown/examples/react
$ cd eslint-plugin-markdown
$ npm install
$ cd examples/react
$ npm test

eslint-plugin-markdown/examples/react/README.md
Expand Down
10 changes: 2 additions & 8 deletions examples/react/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import js from "@eslint/js";
import markdown from "../../src/index.js";
import globals from "globals";
import reactRecommended from "eslint-plugin-react/configs/recommended.js";
import reactPlugin from "eslint-plugin-react";

export default [
js.configs.recommended,
...markdown.configs.recommended,
reactRecommended,
reactPlugin.configs.flat.recommended,
{
settings: {
react: {
Expand All @@ -25,12 +25,6 @@ export default [
globals: globals.browser
}
},
{
files: ["eslint.config.js"],
languageOptions: {
sourceType: "commonjs"
}
},
{
files: ["**/*.md/*.jsx"],
languageOptions: {
Expand Down
7 changes: 3 additions & 4 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
"test": "eslint ."
},
"devDependencies": {
"@eslint/js": "^8.56.0",
"eslint": "^8.56.0",
"eslint-plugin-markdown": "file:../..",
"eslint-plugin-react": "^7.20.3",
"@eslint/js": "^9.7.0",
"eslint": "^9.7.0",
"eslint-plugin-react": "^7.35.0",
"globals": "^13.24.0"
}
}
7 changes: 4 additions & 3 deletions examples/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ hello(42 as any);

```sh
$ git clone https://github.com/eslint/eslint-plugin-markdown.git
$ cd eslint-plugin-markdown/examples/typescript
$ cd eslint-plugin-markdown
$ npm install
$ cd examples/typescript
$ npm test

eslint-plugin-markdown/examples/typescript/README.md
6:22 error Don't use `String` as a type. Use string instead @typescript-eslint/ban-types
10:13 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
6:22 error Prefer using the primitive `string` as a type name, rather than the upper-cased `String` @typescript-eslint/no-wrapper-object-types
10:13 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

✖ 2 problems (2 errors, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
Expand Down
6 changes: 0 additions & 6 deletions examples/typescript/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import tseslint from "typescript-eslint";
export default tseslint.config(
js.configs.recommended,
...markdown.configs.recommended,
{
files: ["eslint.config.js"],
languageOptions: {
sourceType: "commonjs"
}
},
...tseslint.configs.recommended.map(config => ({
...config,
files: ["**/*.ts"]
Expand Down
7 changes: 3 additions & 4 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
"test": "eslint ."
},
"devDependencies": {
"@eslint/js": "^8.56.0",
"eslint": "^8.56.0",
"eslint-plugin-markdown": "file:../..",
"@eslint/js": "^9.7.0",
"eslint": "^9.7.0",
"typescript": "^5.3.3",
"typescript-eslint": "^7.0.1"
"typescript-eslint": "8.0.0-alpha.51"
}
}
8 changes: 4 additions & 4 deletions tests/examples/all.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const examples = fs.readdirSync(examplesDir)
for (const example of examples) {
const cwd = path.join(examplesDir, example);

// The plugin officially supports ESLint as early as v6, but the examples
// use ESLint v8, which has a higher minimum Node.js version than does v6.
// In case when this plugin supports multiple major versions of ESLint,
// CI matrix may include Node.js versions that are not supported by
// the version of ESLint that is used in examples.
// Only exercise the example if the running Node.js version satisfies the
// minimum version constraint. In CI, this will skip these tests in Node.js
// v8 and run them on all other Node.js versions.
// minimum version constraint.
const eslintPackageJsonPath = require.resolve("eslint/package.json", {
paths: [cwd]
});
Expand Down

0 comments on commit 923e440

Please sign in to comment.