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

Alter eslint config to not use function #97

Merged
merged 5 commits into from
Aug 24, 2023
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
106 changes: 52 additions & 54 deletions configs/eslint.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,59 @@
const babelConfig = require('./babel.js');
const { eslintResolver } = require('./../src/utils/get-alias');

module.exports = (projectConfig) => {
return {
globals: {
__DEV__: true,
__PROD__: true,
__TEST__: true,
wp: true,
module.exports = {
globals: {
__DEV__: true,
__PROD__: true,
__TEST__: true,
wp: true,
},
env: {
browser: true,
es2021: true,
node: true,
},
extends: ['airbnb', 'prettier'],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
babelOptions: {
...babelConfig,
},
env: {
browser: true,
es2021: true,
node: true,
},
extends: ['airbnb', 'prettier'],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
babelOptions: {
...babelConfig,
},
plugins: ['@babel', 'react', 'prettier', 'jsdoc'],
settings: {
'import/resolver': eslintResolver('src'),
},
rules: {
complexity: ['error', 10],
'prettier/prettier': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
},
plugins: ['@babel', 'react', 'prettier', 'jsdoc'],
settings: {
'import/resolver': eslintResolver(projectConfig.paths.src),
},
rules: {
complexity: ['error', 10],
'prettier/prettier': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'react/react-in-jsx-scope': 0,
'react/prop-types': 0,
'react/forbid-prop-types': 0,
'react/require-default-props': 0,
'arrow-parens': 2,
'jsdoc/require-jsdoc': [
'error',
{
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: true,
},
],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'react/react-in-jsx-scope': 0,
'react/prop-types': 0,
'react/forbid-prop-types': 0,
'react/require-default-props': 0,
'arrow-parens': 2,
'jsdoc/require-jsdoc': [
'error',
{
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: true,
},
},
],
},
};
},
],
},
};
20 changes: 20 additions & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ You will need to set the prettier config as prettier does not support the abilit
}
```

## VSCode (or other Editor)
While most packages and config will work out of the box there are a number of configs that need defining to give yourself the best compatibility with your Editor setup. These include:

- Prettier
- ESLint

To get these working correctly with your Editor you simply need to reference them in your `package.json` as seen below for `prettier` and `eslintConfig` keys.

```json
{
"name": "my-package",
"version": "1.0.0",
"prettier": "@bigbite/build-tools/configs/prettier",
"eslintConfig": {
"extends": "./node_modules/@bigbite/build-tools/configs/eslint",
},
"dependencies": {}
}
```

## Additional Setup.
Copy/merge the applicable contents of the below files to their respective files in your project.

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bigbite/build-tools",
"version": "1.2.4",
"version": "1.2.5",
"description": "Provides configuration for the Big Bite Build Tools.",
"author": "Paul Taylor <paul@bigbite.net> (https://github.com/ampersarnie)",
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/build/plugins/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const ESLintConfig = require('../../../../configs/eslint');
* Sets the config for the ESLint webpack plugin.
* @returns ESLintPlugin instance.
*/
module.exports = (projectConfig) =>
module.exports = () =>
new ESLintPlugin({
baseConfig: ESLintConfig(projectConfig),
baseConfig: ESLintConfig,
});