Skip to content

Commit

Permalink
Add prettier and reformat files
Browse files Browse the repository at this point in the history
  • Loading branch information
rileytomasek committed May 29, 2023
1 parent 2da6818 commit 9ed14d6
Show file tree
Hide file tree
Showing 22 changed files with 417 additions and 379 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
*.md
package*.json
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# `@remix-run/eslint-config`
# Forked from `@remix-run/eslint-config`

Personal ESlint config forked from Remix to support non-remix environments.

---

This package includes a shareable ESLint config for Remix projects.

Expand Down
46 changes: 23 additions & 23 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
// Splitting rules into separate modules allow for a lower-level API if our
// default rules become difficult to extend without lots of duplication.
const coreRules = require("./rules/core");
const importRules = require("./rules/import");
const reactRules = require("./rules/react");
const jsxA11yRules = require("./rules/jsx-a11y");
const typescriptRules = require("./rules/typescript");
const importSettings = require("./settings/import");
const reactSettings = require("./settings/react");
const coreRules = require('./rules/core');
const importRules = require('./rules/import');
const reactRules = require('./rules/react');
const jsxA11yRules = require('./rules/jsx-a11y');
const typescriptRules = require('./rules/typescript');
const importSettings = require('./settings/import');
const reactSettings = require('./settings/react');

/**
* @see https://github.com/eslint/eslint/issues/3458
* @see https://www.npmjs.com/package/@rushstack/eslint-patch
*/
require("@rushstack/eslint-patch/modern-module-resolution");
require('@rushstack/eslint-patch/modern-module-resolution');

const OFF = 0;
// const WARN = 1;
// const ERROR = 2;

/** @type {import('eslint').Linter.Config} */
const config = {
parser: "@babel/eslint-parser",
parser: '@babel/eslint-parser',
parserOptions: {
sourceType: "module",
sourceType: 'module',
requireConfigFile: false,
ecmaVersion: "latest",
ecmaVersion: 'latest',
babelOptions: {
presets: [require.resolve("@babel/preset-react")],
presets: [require.resolve('@babel/preset-react')],
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},
plugins: ["import", "react", "react-hooks", "jsx-a11y"],
plugins: ['import', 'react', 'react-hooks', 'jsx-a11y'],
settings: {
...reactSettings,
...importSettings,
Expand All @@ -61,34 +61,34 @@ const config = {
},
overrides: [
{
files: ["**/*.ts?(x)"],
extends: ["plugin:import/typescript"],
parser: "@typescript-eslint/parser",
files: ['**/*.ts?(x)'],
extends: ['plugin:import/typescript'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: "module",
sourceType: 'module',
ecmaVersion: 2019,
ecmaFeatures: {
jsx: true,
},
warnOnUnsupportedTypeScriptVersion: true,
},
plugins: ["@typescript-eslint"],
plugins: ['@typescript-eslint'],
rules: {
...typescriptRules,
},
},
{
files: [
"**/routes/**/*.js?(x)",
"**/routes/**/*.tsx",
"app/root.js?(x)",
"app/root.tsx",
'**/routes/**/*.js?(x)',
'**/routes/**/*.tsx',
'app/root.js?(x)',
'app/root.tsx',
],
rules: {
// Routes may use default exports without a name. At the route level
// identifying components for debugging purposes is less of an issue, as
// the route boundary is more easily identifiable.
"react/display-name": OFF,
'react/display-name': OFF,
},
},
],
Expand Down
64 changes: 32 additions & 32 deletions internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @see https://github.com/eslint/eslint/issues/3458
* @see https://www.npmjs.com/package/@rushstack/eslint-patch
*/
require("@rushstack/eslint-patch/modern-module-resolution");
require('@rushstack/eslint-patch/modern-module-resolution');

const OFF = 0;
const WARN = 1;
Expand All @@ -17,8 +17,8 @@ const ERROR = 2;
module.exports = {
root: true,
extends: [
require.resolve("./index.js"),
require.resolve("./jest-testing-library.js"),
require.resolve('./index.js'),
require.resolve('./jest-testing-library.js'),
],
env: {
node: true,
Expand All @@ -27,62 +27,62 @@ module.exports = {
// Plugins used in the internal config should be installed in our
// repositories. We don't want to ship these as dependencies to consumers
// who may not use them.
"node",
"prefer-let",
'node',
'prefer-let',
],
rules: {
"@typescript-eslint/consistent-type-imports": ERROR,
"import/order": [
'@typescript-eslint/consistent-type-imports': ERROR,
'import/order': [
ERROR,
{
"newlines-between": "always",
'newlines-between': 'always',
groups: [
["builtin", "external"],
"internal",
["parent", "sibling", "index"],
['builtin', 'external'],
'internal',
['parent', 'sibling', 'index'],
],
},
],
"jest/no-disabled-tests": OFF,
"prefer-let/prefer-let": WARN,
'jest/no-disabled-tests': OFF,
'prefer-let/prefer-let': WARN,
},
overrides: [
{
// all code blocks in .md files
files: ["**/*.md/*.js?(x)", "**/*.md/*.ts?(x)"],
files: ['**/*.md/*.js?(x)', '**/*.md/*.ts?(x)'],
rules: {
"no-unreachable": OFF,
"no-unused-expressions": OFF,
"no-unused-labels": OFF,
"no-unused-vars": OFF,
"prefer-const": WARN,
"jsx-a11y/alt-text": OFF,
"jsx-a11y/anchor-has-content": OFF,
"prefer-let/prefer-let": OFF,
"react/jsx-no-comment-textnodes": OFF,
"react/jsx-no-undef": OFF,
'no-unreachable': OFF,
'no-unused-expressions': OFF,
'no-unused-labels': OFF,
'no-unused-vars': OFF,
'prefer-const': WARN,
'jsx-a11y/alt-text': OFF,
'jsx-a11y/anchor-has-content': OFF,
'prefer-let/prefer-let': OFF,
'react/jsx-no-comment-textnodes': OFF,
'react/jsx-no-undef': OFF,
},
},
{
// all ```ts & ```tsx code blocks in .md files
files: ["**/*.md/*.ts?(x)"],
files: ['**/*.md/*.ts?(x)'],
rules: {
"@typescript-eslint/no-unused-expressions": OFF,
"@typescript-eslint/no-unused-vars": OFF,
'@typescript-eslint/no-unused-expressions': OFF,
'@typescript-eslint/no-unused-vars': OFF,
},
},
{
files: ["packages/**/*.*"],
excludedFiles: "**/__tests__/**/*.*",
files: ['packages/**/*.*'],
excludedFiles: '**/__tests__/**/*.*',
rules: {
// Validate dependencies are listed in workspace package.json files
"import/no-extraneous-dependencies": ERROR,
'import/no-extraneous-dependencies': ERROR,
},
},
{
files: ["integration/**/*.*"],
files: ['integration/**/*.*'],
env: {
"jest/globals": false,
'jest/globals': false,
},
},
],
Expand Down
14 changes: 7 additions & 7 deletions jest-testing-library.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
const jestRules = require("./rules/jest");
const jestDomRules = require("./rules/jest-dom");
const testingLibraryRules = require("./rules/testing-library");
const jestRules = require('./rules/jest');
const jestDomRules = require('./rules/jest-dom');
const testingLibraryRules = require('./rules/testing-library');

/**
* @see https://github.com/eslint/eslint/issues/3458
* @see https://www.npmjs.com/package/@rushstack/eslint-patch
*/
require("@rushstack/eslint-patch/modern-module-resolution");
require('@rushstack/eslint-patch/modern-module-resolution');

module.exports = {
plugins: ["jest", "jest-dom", "testing-library"],
plugins: ['jest', 'jest-dom', 'testing-library'],
env: {
node: true,
},
overrides: [
{
files: ["**/__tests__/**/*", "**/*.{spec,test}.*"],
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
env: {
"jest/globals": true,
'jest/globals': true,
},
rules: {
...jestRules,
Expand Down
20 changes: 10 additions & 10 deletions jest.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const jestRules = require("./rules/jest");
const jestRules = require('./rules/jest');

/**
* @see https://github.com/eslint/eslint/issues/3458
* @see https://www.npmjs.com/package/@rushstack/eslint-patch
*/
require("@rushstack/eslint-patch/modern-module-resolution");
require('@rushstack/eslint-patch/modern-module-resolution');

const alreadyWarned = {};
const warnOnce = (condition, message) => {
Expand All @@ -16,26 +16,26 @@ const warnOnce = (condition, message) => {

warnOnce(
false,
"⚠️ DEPRECATED: The `@remix-run/eslint-config/jest` ESLint config " +
"has been deprecated in favor of " +
"`@remix-run/eslint-config/jest-testing-library` and will be removed in " +
"Remix v2. Please update your code to use " +
"`@remix-run/eslint-config/jest-testing-library` instead."
'⚠️ DEPRECATED: The `@remix-run/eslint-config/jest` ESLint config ' +
'has been deprecated in favor of ' +
'`@remix-run/eslint-config/jest-testing-library` and will be removed in ' +
'Remix v2. Please update your code to use ' +
'`@remix-run/eslint-config/jest-testing-library` instead.'
);

/**
* @deprecated Use `@remix-run/eslint-config/jest-testing-library` instead.
*/
const jestConfig = {
plugins: ["jest"],
plugins: ['jest'],
env: {
node: true,
},
overrides: [
{
files: ["**/__tests__/**/*", "**/*.{spec,test}.*"],
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
env: {
"jest/globals": true,
'jest/globals': true,
},
rules: {
...jestRules,
Expand Down
4 changes: 2 additions & 2 deletions node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* @see https://github.com/eslint/eslint/issues/3458
* @see https://www.npmjs.com/package/@rushstack/eslint-patch
*/
require("@rushstack/eslint-patch/modern-module-resolution");
require('@rushstack/eslint-patch/modern-module-resolution');

module.exports = {
plugins: ["node"],
plugins: ['node'],
env: {
node: true,
},
Expand Down
17 changes: 16 additions & 1 deletion package-lock.json

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

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"rules",
"settings"
],
"scripts": {
"format": "prettier --write ."
},
"dependencies": {
"@babel/core": "^7.21.8",
"@babel/eslint-parser": "^7.21.8",
Expand All @@ -38,7 +41,8 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^5.10.2"
"eslint-plugin-testing-library": "^5.10.2",
"prettier": "^2.8.8"
},
"devDependencies": {
"@types/eslint": "^8.37.0",
Expand Down
Loading

0 comments on commit 9ed14d6

Please sign in to comment.