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

feat: add eslint #87

Merged
merged 1 commit into from
Sep 10, 2024
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
20 changes: 20 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import pluginReact from "eslint-plugin-react";
import vitest from "eslint-plugin-vitest";

export default [
{
files: ["**/*.{js,mjs,cjs,jsx}"],
plugins: {
vitest
},
rules: {
...vitest.configs.recommended.rules,
"vitest/expect-expect": "off"
}
},
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended
];
18 changes: 7 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"web-vitals": "4.2.2"
},
"devDependencies": {
"@eslint/js": "^9.10.0",
"@playwright/test": "^1.45.3",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.4.8",
Expand All @@ -16,9 +17,14 @@
"@vitejs/plugin-react-swc": "^3.7.0",
"@vitest/coverage-v8": "^2.0.5",
"bestzip": "^2.2.1",
"eslint": "^9.10.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-vitest": "^0.5.4",
"globals": "^15.9.0",
"jsdom": "^24.1.1",
"ncp": "^2.0.0",
"prettier": "^3.3.3",
"prop-types": "^15.8.1",
"vite": "^5.3.4",
"vitest": "^2.0.4"
},
Expand All @@ -31,20 +37,10 @@
"test": "vitest test",
"eject": "react-scripts eject",
"create-zip": "cd build && bestzip build.zip *",
"lint": "eslint src/**/*.js",
"lint": "eslint src/",
"_format": "prettier \"**/*.{js,jsx,css,html}\"",
"format": "npm run _format -- --write"
},
"eslintConfig": {
"extends": [
"eslint:recommended",
"react-app",
"react-app/jest"
],
"rules": {
"quotes": "error"
}
},
"browserslist": {
"production": [
">0.2%",
Expand Down
9 changes: 8 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useLayoutEffect, useRef, useState } from "react";
import React, { useEffect, useLayoutEffect, useRef, useState } from "react";
import "./App.css";
import PropTypes from "prop-types";

const defaultEndpoint = "http://rdf.insee.fr/sparql";
const defaultPrefix = "https://rdf.insee.fr/sparql?query=DESCRIBE";
Expand Down Expand Up @@ -70,6 +71,12 @@ function Editor({ endpoint, queries, prefix }) {
);
}

Editor.propTypes = {
endpoint: PropTypes.string,
queries: PropTypes.array,
prefix: PropTypes.string
};

function App() {
const [queries, setQueries] = useState([]);
const [prefix, setPrefix] = useState();
Expand Down
1 change: 1 addition & 0 deletions src/App.test.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import { render } from "@testing-library/react";
import App from "./App";
import { test, vi } from "vitest";
Expand Down
8 changes: 4 additions & 4 deletions src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import "./index.css";
import { createRoot } from "react-dom/client";

ReactDOM.render(
const root = createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
</React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
Expand Down
Loading