Skip to content

Commit

Permalink
feat: convert eslintrc into ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki0410-dev committed May 3, 2024
1 parent 30d9edb commit 1cfa34c
Show file tree
Hide file tree
Showing 4 changed files with 485 additions and 122 deletions.
61 changes: 0 additions & 61 deletions .eslintrc

This file was deleted.

88 changes: 88 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//@ts-check
/**
* Prettier Configuration
* @type {import('eslint').Linter.Config}
*/
const config = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier",
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "import", "unused-imports"],
parserOptions: {
project: "./tsconfig.json",
},
rules: {
"no-unused-vars": "off", // Duplicate with unused-import/no-unused-vars
"no-param-reassign": "warn",

"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{ checksVoidReturn: false },
],
"@typescript-eslint/no-floating-promises": [
"warn",
{
ignoreIIFE: true,
},
],

// Import Rules
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type",
],
"newlines-between": "always",
pathGroups: [
{
pattern: "~/**",
group: "parent",
position: "before",
},
],
alphabetize: { order: "asc", caseInsensitive: true },
},
],
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports" },
],
"import/no-duplicates": ["error", { considerQueryString: true }],

// React
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
},
settings: {
react: {
version: "detect",
},
},
ignorePatterns: ["*.js", "*.jsx"],
};

module.exports = config;
36 changes: 12 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,9 @@
"module": "dist/es/index.js",
"unpkg": "dist/react-datepicker.min.js",
"style": "dist/react-datepicker.min.css",
"files": [
"*.md",
"dist",
"lib",
"es",
"src/stylesheets"
],
"sideEffects": [
"**/*.css"
],
"keywords": [
"react",
"datepicker",
"calendar",
"date",
"react-component"
],
"files": ["*.md", "dist", "lib", "es", "src/stylesheets"],
"sideEffects": ["**/*.css"],
"keywords": ["react", "datepicker", "calendar", "date", "react-component"],
"repository": {
"type": "git",
"url": "git://github.com/Hacker0x01/react-datepicker.git"
Expand All @@ -53,13 +39,18 @@
"@types/jest": "^29.5.12",
"@types/node": "20",
"@types/react-onclickoutside": "^6.7.10",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"axe-core": "^4.4.1",
"babel-jest": "^29.6.4",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"core-js": "^3.29.1",
"eslint": "^8.44.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-unused-imports": "^3.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-unused-imports": "^3.1.0",
"husky": "9",
"jest": "^29.6.4",
"jest-canvas-mock": "^2.5.2",
Expand Down Expand Up @@ -93,7 +84,7 @@
"react-onclickoutside": "^6.13.0"
},
"scripts": {
"eslint": "eslint --ext .js,.jsx src test",
"eslint": "eslint --ext .ts,.tsx src test",
"precommit": "lint-staged --allow-empty",
"sass-lint": "stylelint 'src/stylesheets/*.scss'",
"lint": "yarn run eslint && yarn run sass-lint",
Expand All @@ -117,10 +108,7 @@
"prepare": "husky install"
},
"lint-staged": {
"*.{js,jsx,json,css,scss,md}": [
"prettier --write",
"git add"
]
"*.{js,jsx,ts,tsx,json,css,scss,md}": ["prettier --write", "git add"]
},
"packageManager": "yarn@1.22.17"
}

0 comments on commit 1cfa34c

Please sign in to comment.