Skip to content

Commit

Permalink
Merge pull request #97 from ampersarnie/hotfix/eslint-expose
Browse files Browse the repository at this point in the history
Alter eslint config to not use function
  • Loading branch information
ampersarnie authored Aug 24, 2023
2 parents 0e2ab74 + 8f71f10 commit 5de2339
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 59 deletions.
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 <[email protected]> (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,
});

0 comments on commit 5de2339

Please sign in to comment.