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

v7 #173

Merged
merged 97 commits into from Feb 3, 2022
Merged

v7 #173

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
39d5873
Updates dependencies.
manovotny Sep 21, 2021
d7bcb0a
Updates `@rushstack/eslint-patch` and `jest`.
manovotny Sep 26, 2021
7bf2d51
Updates eslint.
manovotny Sep 27, 2021
04ac1c8
Updates babel dependencies.
manovotny Sep 27, 2021
05e01f4
Updates eslint-plugin-get-off-my-lawn.
manovotny Sep 27, 2021
90e9c78
Updates eslint-plugin-import.
manovotny Sep 27, 2021
14690da
Updates eslint-plugin-jest.
manovotny Sep 27, 2021
d880c39
Updates eslint-plugin-react-native.
manovotny Sep 27, 2021
a442663
Updates eslint-plugin-react.
manovotny Sep 27, 2021
44c80cc
Replaces `eslint-plugin-json` with `eslint-plugin-jsonc`.
manovotny Sep 28, 2021
3c9c0bd
Updates jest.
manovotny Sep 28, 2021
73053ab
Adds `dot-location` rule.
manovotny Oct 29, 2021
b776779
Updates eslint-plugin-unicorn.
manovotny Oct 31, 2021
e739ac3
Updates @rushstack/eslint-patch, typescript, jest, and lint-staged.
manovotny Oct 31, 2021
1bf98a4
Updates eslint-plugin-react.
manovotny Oct 31, 2021
6872d1b
Updates eslint-plugin-jest.
manovotny Nov 1, 2021
2409f32
Updates eslint-plugin-import.
manovotny Nov 1, 2021
7039c46
Updates @babel/core, @babel/eslint-parser, and @babel/preset-react
manovotny Nov 1, 2021
24f9f29
Updates eslint-config-prettier.
manovotny Nov 1, 2021
58100fa
Changes `ecmaVersion` to `latest`.
manovotny Nov 1, 2021
fec6b8d
Replaces `@zeit/git-hooks` with rebranded `@vercel/git-hooks`.
manovotny Nov 1, 2021
5818640
Changes React file extension from `.js` to `.jsx`.
manovotny Nov 8, 2021
3f7fe0e
Disables `react/jsx-uses-react` and `react/react-in-jsx-scope` for Re…
manovotny Nov 8, 2021
62d3205
Removes `lines-between-class-members` rule.
manovotny Dec 9, 2021
f4d633e
Updates to ESlint 8. (#175)
manovotny Dec 9, 2021
27c8ebc
Updates @babel/eslint-parser, @rushstack/eslint-patch, typescript, je…
manovotny Dec 9, 2021
9f10d5d
Updates eslint-plugin-get-off-my-lawn.
manovotny Dec 9, 2021
b010bf2
Updates eslint-plugin-import.
manovotny Dec 9, 2021
bc3d9ff
Updates eslint.
manovotny Dec 9, 2021
94c5802
Updates eslint-plugin-jest.
manovotny Dec 10, 2021
a227b4e
Updates eslint-plugin-jsx-a11y.
manovotny Dec 10, 2021
3ea1785
Updates eslint-plugin-react.
manovotny Dec 10, 2021
cf2cc7f
Updates eslint-plugin-react-hooks.
manovotny Dec 10, 2021
5fc972e
Updates eslint-plugin-jsonc.
manovotny Dec 10, 2021
c9ed8a5
Updates eslint-plugin-unicorn.
manovotny Dec 10, 2021
7d7765f
Updates jest.
manovotny Dec 10, 2021
3836bd3
Updates the minimum version of node.
manovotny Dec 10, 2021
98c6151
Updates eslint-plugin-react-native.
manovotny Dec 11, 2021
0d36b47
Updates readme with jsonc plugin usage.
manovotny Dec 11, 2021
77694e4
Adds eslint-plugin-jest-formatting.
manovotny Dec 11, 2021
a3defa5
Changes eslint-plugin-jest-formatting to use individual rules instead…
manovotny Dec 11, 2021
ab357e6
Adds eslint-plugin-next.
manovotny Dec 12, 2021
46b72eb
Updates node version.
manovotny Dec 13, 2021
cf11b74
Updates @babel/core, @babel/eslint-parser, @babel/preset-react, confu…
manovotny Dec 16, 2021
4ca006d
7.0.0-beta.1 release.
manovotny Dec 16, 2021
4176e0c
Fixes eslint-plugin-next configuration.
manovotny Dec 18, 2021
e4a188a
Removes `resolves` option from jest/no-restricted-matchers.
manovotny Dec 18, 2021
f163248
7.0.0-beta.2 release.
manovotny Dec 18, 2021
9867c6f
Removes unnecessary `prettier` from project ESLint config.
manovotny Dec 19, 2021
04caeeb
Adds @typescript-eslint/eslint-plugin.
manovotny Jan 11, 2022
aca36b0
Adds more keywords.
manovotny Jan 11, 2022
30e8891
Updates jest and lint-staged.
manovotny Jan 11, 2022
05a2f48
Updates @babel/preset-react.
manovotny Jan 11, 2022
8d91a30
Updates eslint-plugin-import, eslint-plugin-jest, eslint-plugin-react…
manovotny Jan 11, 2022
8ec89db
Updates eslint-plugin-next.
manovotny Jan 12, 2022
6f08187
7.0.0-beta.3 release.
manovotny Jan 12, 2022
2d6b9c0
Updates supported extensions.
manovotny Jan 12, 2022
6264257
Simplifies configuration.
manovotny Jan 14, 2022
e49caae
7.0.0-beta.4 release.
manovotny Jan 14, 2022
61afba3
Fixes TypeScript issues for imports and `no-undef`.
manovotny Jan 19, 2022
225a516
Adds `import/resolver` for React.
manovotny Jan 19, 2022
3d68830
Updates dependencies.
manovotny Jan 19, 2022
a3662d6
Fixes lint.
manovotny Jan 19, 2022
a0703ae
7.0.0-beta.5 release.
manovotny Jan 19, 2022
3caa18a
Fixes json and prettier conficts.
manovotny Jan 20, 2022
e140055
7.0.0-beta.6 release.
manovotny Jan 21, 2022
01ea74f
Updates dependencies.
manovotny Jan 21, 2022
6e1d809
Removes `@typescript-eslint/strict-boolean-expressions`.
manovotny Jan 21, 2022
a1a9639
Fixes `react/jsx-filename-extension` error on TypeScript projects tha…
manovotny Jan 21, 2022
530c320
Changes locate to return an absolute path.
manovotny Jan 21, 2022
e422cbf
Centralizes dependencies.
manovotny Jan 21, 2022
a1da160
Conditionally removes `unicorn/no-null` if GraphQL is used.
manovotny Jan 21, 2022
3f98899
Fixes lint errors.
manovotny Jan 21, 2022
4be2162
Fixes `@typescript-eslint/unbound-method` conflict with Jest.
manovotny Jan 21, 2022
f7c9c8d
7.0.0-beta.7 release.
manovotny Jan 22, 2022
a2be2e8
Updates dependencies.
manovotny Jan 25, 2022
17f5575
Adds node protocol enhancements.
manovotny Jan 29, 2022
de94c7a
Removes eslint-comments/no-unlimited-disable as it is a duplicate of …
manovotny Jan 29, 2022
aad40e2
Conditionally enables / disables `import/extensions` based on ESM usage.
manovotny Jan 29, 2022
f237a9b
Changes condition rules to be deleted instead of just turned off.
manovotny Jan 30, 2022
b7128f6
Changes node globals based on node documentation.
manovotny Jan 31, 2022
850ea3d
Splits `files` into `locate` and `content`.
manovotny Jan 31, 2022
ff654a6
Changes the Jest file match in TypeScript overrides to use Jest confi…
manovotny Jan 31, 2022
98dc6eb
Updates dependencies.
manovotny Jan 31, 2022
f614740
7.0.0-beta.8 release.
manovotny Jan 31, 2022
947805c
Fixes react jsx trasnform issues and adds tests.
manovotny Jan 31, 2022
8e6eb85
Properly excludes tests from published package.
manovotny Jan 31, 2022
207fc36
Fixes import/extensions issues with CJS and ESM.
manovotny Jan 31, 2022
31e82b5
Fixes lint errors.
manovotny Jan 31, 2022
a607964
Refactors test strucrture.
manovotny Jan 31, 2022
5d13541
Fixes unicorn/prefer-node-protocol check and adds tests.
manovotny Jan 31, 2022
1bc74e6
7.0.0-beta.9 release.
manovotny Feb 1, 2022
604b826
Updates dependencies.
manovotny Feb 1, 2022
f9decb1
Updates dependencies.
manovotny Feb 3, 2022
8187d9a
Conditionally removes `unicorn/prefer-node-protocol` rule when `next`…
manovotny Feb 3, 2022
a570659
Fixes lint.
manovotny Feb 3, 2022
6370801
7.0.0 release.
manovotny Feb 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
@@ -1,3 +1,3 @@
module.exports = {
extends: ['./index.js', 'prettier'],
extends: ['./index.js'],
};
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
14.17.4
16.13.1
145 changes: 30 additions & 115 deletions index.js
@@ -1,132 +1,47 @@
// This is a workaround for: https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-patch/modern-module-resolution');

const dotProp = require('dot-prop');
const findUp = require('find-up');
const readPkgUp = require('read-pkg-up');
const semver = require('semver');
const {mergeAndConcat} = require('merge-anything');

const babel = require('./src/babel');
const electron = require('./src/electron');
const eslint = require('./src/eslint');
const eslintComments = require('./src/eslint-comments');
const comments = require('./src/comments');
const getOffMyLawn = require('./src/get-off-my-lawn');
const imprt = require('./src/import');
const json = require('./src/json');
const jsxA11y = require('./src/jsx-a11y');
const jest = require('./src/jest');
const json = require('./src/json');
const next = require('./src/next');
const node = require('./src/node');
const objects = require('./src/objects');
const prettier = require('./src/prettier');
const react = require('./src/react');
const reactHooks = require('./src/react-hooks');
const reactNative = require('./src/react-native');
const security = require('./src/security');
const typescript = require('./src/typescript');
const unicorn = require('./src/unicorn');

const pkg = readPkgUp.sync() || {};

const packageJsonContains = (dependency) =>
dotProp.get(pkg, `packageJson.dependencies.${dependency}`) ||
dotProp.get(pkg, `packageJson.devDependencies.${dependency}`);

const usesBabelConfig = findUp.sync(['.babelrc', '.babelrc.json', 'babel.config.json']);
const usesElectron = packageJsonContains('electron');
const usesJest = packageJsonContains('jest');
const usesNext = packageJsonContains('next');
const usesPrettier = packageJsonContains('prettier');
const usesReact = packageJsonContains('react');
const usesReactNative = packageJsonContains('react-native');
const reactVersion = usesReact ? semver.coerce(usesReact).version : undefined;

const config = {
env: {
browser: true,
commonjs: true,
es2021: true,
node: true,
'shared-node-browser': true,
},
parser: '@babel/eslint-parser',
parserOptions: {
allowImportExportEverywhere: true,
ecmaVersion: 2021,
requireConfigFile: false,
sourceType: 'module',
},
plugins: ['eslint-comments', 'get-off-my-lawn', 'import', 'json', 'node', 'objects', 'security', 'unicorn'],
reportUnusedDisableDirectives: true,
rules: {
...eslint,
...eslintComments,
...getOffMyLawn,
...imprt,
...json,
...node,
...objects,
...security,
...unicorn,
},
};

if (usesElectron) {
dotProp.set(config, 'settings.node.allowModules', ['electron']);
}

if (usesJest) {
dotProp.set(config, 'env.jasmine', true);
dotProp.set(config, 'env.jest', true);
config.plugins.push('jest');
config.rules = {
...config.rules,
...jest,
};
}

if (usesReact) {
dotProp.set(config, 'parserOptions.ecmaFeatures.jsx', true);
dotProp.set(config, 'settings.react.version', 'detect');
config.plugins.push('react');
config.rules = {
...config.rules,
...react,
};

if (semver.gte(reactVersion, '16.8.0')) {
config.plugins.push('react-hooks');
config.rules = {
...config.rules,
...reactHooks,
};
}

if (usesReactNative) {
dotProp.set(config, 'env.react-native/react-native', true);
config.plugins.push('react-native');
config.rules = {
...config.rules,
...reactNative,
};
} else {
config.plugins.push('jsx-a11y');
config.rules = {
...config.rules,
...jsxA11y,
};
}
}

if (usesBabelConfig) {
dotProp.set(config, 'parserOptions.babelOptions.configFile', usesBabelConfig);
dotProp.set(config, 'parserOptions.requireConfigFile', true);
} else if (usesNext) {
dotProp.set(config, 'parserOptions.babelOptions.presets', ['next/babel']);
} else if (usesReact) {
dotProp.set(config, 'parserOptions.babelOptions.presets', ['@babel/preset-react']);
}

if (usesPrettier) {
config.rules = {
...config.rules,
...require('eslint-config-prettier').rules,
};
}
const config = mergeAndConcat(
// Order of these doesn't matter.
comments,
babel,
electron,
eslint,
getOffMyLawn,
imprt,
jest,
json,
next,
node,
objects,
react,
reactNative,
security,
unicorn,
// These need to be listed last, and in this order, to override
// or modify rules in the various configs above, as needed.
typescript,
prettier
);

module.exports = config;
8 changes: 0 additions & 8 deletions jest.config.js
@@ -1,12 +1,4 @@
module.exports = {
coverageDirectory: '.coverage',
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
testEnvironment: 'node',
};