-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Align the eslint configuration with the main repository (#23)
- Loading branch information
1 parent
825445c
commit 59d5336
Showing
17 changed files
with
341 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,99 @@ | ||
const confusingBrowserGlobals = require('confusing-browser-globals'); | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
parser: "@typescript-eslint/parser", // Specifies the ESLint parser | ||
extends: [ | ||
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react | ||
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | ||
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | ||
root: true, // So parent files don't get applied | ||
globals: { | ||
preval: false, // Used in the documentation | ||
}, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
node: true, | ||
}, | ||
extends: ['airbnb', 'prettier', 'prettier/react'], | ||
parser: 'babel-eslint', | ||
parserOptions: { | ||
ecmaVersion: 7, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['babel', 'react-hooks'], | ||
settings: {}, | ||
/** | ||
* Sorted alphanumerically within each group. built-in and each plugin form | ||
* their own groups. | ||
*/ | ||
rules: { | ||
'consistent-this': ['error', 'self'], | ||
'linebreak-style': 'off', // Doesn't play nicely with Windows | ||
// just as bad as "max components per file" | ||
'max-classes-per-file': 'off', | ||
'no-alert': 'error', | ||
// Strict, airbnb is using warn; allow warn and error for dev environments | ||
'no-console': ['error', { allow: ['warn', 'error'] }], | ||
'no-constant-condition': 'error', | ||
// Airbnb use error | ||
'no-param-reassign': 'off', | ||
'no-prototype-builtins': 'off', | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
patterns: [ | ||
'@material-ui/*/*/*', | ||
'!@material-ui/core/test-utils/*', | ||
'!@material-ui/utils/macros/*.macro', | ||
], | ||
}, | ||
], | ||
plugins: [ | ||
"unused-imports" , | ||
"react-hooks" | ||
'nonblock-statement-body-position': 'error', | ||
// Airbnb restricts isNaN and isFinite which are necessary for IE 11 | ||
// we have to be disciplined about the usage and ensure the Number type for its | ||
// arguments | ||
'no-restricted-globals': ['error'].concat(confusingBrowserGlobals), | ||
'no-underscore-dangle': 'error', | ||
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }], | ||
'prefer-destructuring': 'off', // Destructuring harm grep potential. | ||
|
||
'jsx-a11y/label-has-associated-control': 'off', | ||
'jsx-a11y/label-has-for': 'off', // deprecated | ||
'jsx-a11y/no-autofocus': 'off', // We are a library, people do what they want. | ||
|
||
// This rule is great for raising people awareness of what a key is and how it works. | ||
'react/no-array-index-key': 'off', | ||
'react/destructuring-assignment': 'off', | ||
// It's buggy | ||
'react/forbid-prop-types': 'off', | ||
'react/jsx-curly-brace-presence': 'off', | ||
// prefer <React.Fragment> over <>. The former allows `key` while the latter doesn't | ||
'react/jsx-fragments': ['error', 'element'], | ||
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }], // airbnb is using .jsx | ||
'react/jsx-handler-names': [ | ||
'error', | ||
{ | ||
// airbnb is disabling this rule | ||
eventHandlerPrefix: 'handle', | ||
eventHandlerPropPrefix: 'on', | ||
}, | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features | ||
sourceType: "module", // Allows for the use of imports | ||
ecmaFeatures: { | ||
jsx: true // Allows for the parsing of JSX | ||
} | ||
}, | ||
rules: { | ||
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs | ||
// e.g. "@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"unused-imports/no-unused-imports-ts": 2, | ||
"unused-imports/no-unused-vars-ts": 1, | ||
"react/prop-types": 0, | ||
"eslint-disable react/display-name":0, | ||
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks | ||
"react-hooks/exhaustive-deps": "error" // Checks effect dependencies | ||
}, | ||
settings: { | ||
react: { | ||
version: "detect" // Tells eslint-plugin-react to automatically detect the version of React to use | ||
} | ||
} | ||
}; | ||
// not a good rule for components close to the DOM | ||
'react/jsx-props-no-spreading': 'off', | ||
'react/no-danger': 'error', | ||
// Strict, airbnb is using off | ||
'react/no-direct-mutation-state': 'error', | ||
'react/no-find-dom-node': 'off', | ||
'react/no-multi-comp': 'off', | ||
'react/require-default-props': 'off', | ||
'react/sort-prop-types': 'error', | ||
// This depends entirely on what you're doing. There's no universal pattern | ||
'react/state-in-constructor': 'off', | ||
// stylistic opinion. For conditional assignment we want it outside, otherwise as static | ||
'react/static-property-placement': 'off', | ||
|
||
'react-hooks/rules-of-hooks': 'error', | ||
'react-hooks/exhaustive-deps': ['error', { additionalHooks: 'useEnhancedEffect' }], | ||
|
||
'import/no-unresolved': 'off', | ||
'import/no-extraneous-dependencies': 'off', | ||
}, | ||
overrides: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
.DS_STORE | ||
*.log | ||
/.eslintcache | ||
dist | ||
node_modules | ||
__diff_output__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
#!/usr/bin/env node | ||
|
||
require = require('esm')(module /*, options*/); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
// eslint-disable-next-line no-global-assign | ||
require = require('esm')(module); | ||
|
||
require('../dist/index-cjs').datagenCli(process.argv); |
22 changes: 0 additions & 22 deletions
22
packages/grid/x-grid-data-generator/bin/data-gen-script_BAK.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
#!/usr/bin/env node | ||
|
||
require = require('esm')(module /*, options*/); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
// eslint-disable-next-line no-global-assign | ||
require = require('esm')(module); | ||
|
||
require('../dist/cjs/license-cli').licenseGenCli(process.argv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
const { toMatchImageSnapshot } = require('jest-image-snapshot'); | ||
|
||
// eslint-disable-next-line no-undef | ||
expect.extend({ toMatchImageSnapshot }); |
Oops, something went wrong.