Skip to content

Commit

Permalink
Merge pull request #11 from mvarendorff/feat-curly-braces
Browse files Browse the repository at this point in the history
feat: react rules
  • Loading branch information
mvarendorff2 authored May 15, 2023
2 parents 9031210 + f55badc commit b433e65
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 2 deletions.
5 changes: 4 additions & 1 deletion eslint/next.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const ignores = require('./common/ignores');
const react = require('./react');

/**
* @type {(nextPlugin: import('eslint').ESLint.Plugin) => import('eslint').Linter.FlatConfig}
Expand All @@ -10,10 +11,12 @@ module.exports = (nextPlugin) => {
return {
files: ['**/*.{ts,tsx,js,jsx}'],
ignores,
plugins: {'@next/next': nextPlugin},
plugins: {'@next/next': nextPlugin, ...react.plugins},
settings: {...react.settings},
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs['core-web-vitals'].rules,
...react.rules,
},
};
};
25 changes: 25 additions & 0 deletions eslint/react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const reactPlugin = require("eslint-plugin-react");
const ignores = require('./common/ignores');

const {recommended, "jsx-runtime": jsxRuntime} = reactPlugin.configs;

/**
* @type {import('eslint').Linter.FlatConfig}
*/
module.exports = {
files: ['**/*.tsx', '**/*.jsx'],
ignores,
plugins: {react: reactPlugin},
settings: {
"react": {
version: "detect",
},
},
rules: {
...recommended.rules,
...jsxRuntime.rules,
'react/prop-types': "off",
'react/require-default-props': 'off',
'react/jsx-curly-brace-presence': ["error", "never"],
},
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atmina/linting",
"version": "0.0.11",
"version": "0.0.12",
"description": "A collection of opinionated in-house linting rules.",
"main": "index.js",
"scripts": {},
Expand Down Expand Up @@ -33,6 +33,7 @@
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-tailwindcss": "^3.10.1",
"globals": "^13.20.0"
},
Expand Down
115 changes: 115 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit b433e65

Please sign in to comment.