Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: planetlabs/eslint-config-planet
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v20.0.0
Choose a base ref
...
head repository: planetlabs/eslint-config-planet
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 2,901 additions and 1,759 deletions.
  1. +12 −0 .github/dependabot.yml
  2. +14 −16 .github/workflows/test.yml
  3. +0 −2 .npmignore
  4. +3 −0 eslint.config.js
  5. +3 −3 examples/es6/main.js
  6. +1 −1 examples/react/component.js
  7. +23 −0 examples/react/component.tsx
  8. +90 −82 index.js
  9. +2,660 −1,576 package-lock.json
  10. +19 −19 package.json
  11. +55 −34 react.js
  12. +21 −26 readme.md
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
versioning-strategy: increase-if-necessary
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
30 changes: 14 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -8,26 +8,24 @@ on:
branches:
- main

env:
CI: true

jobs:
run:
test:
name: Test
runs-on: ubuntu-latest

strategy:
matrix:
node:
- 14

steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Clone Repository
uses: actions/checkout@v4

- name: Set Node.js version
uses: actions/setup-node@v1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: '20'

- name: Install Dependencies
run: npm ci

- run: npm ci
- run: npm test
- name: Run Tests
run: npm test
env:
CI: true
2 changes: 0 additions & 2 deletions .npmignore

This file was deleted.

3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import planetConfig from './react.js';

export default [...planetConfig];
6 changes: 3 additions & 3 deletions examples/es6/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import foo from './local-module';
import fs from 'fs';
import path from 'path';
import foo from './local-module.js';

const main = paths =>
Promise.all(
@@ -14,7 +14,7 @@ const main = paths =>
}
});
});
})
}),
);

exports.modifyProps = props => {
@@ -23,7 +23,7 @@ exports.modifyProps = props => {

if (require.main === module) {
const paths = ['main.js', '.eslintrc'].map(name =>
path.join(__dirname, name)
path.join(__dirname, name),
);
main(paths)
.then(contents => {
2 changes: 1 addition & 1 deletion examples/react/component.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {string} from 'prop-types';
import React, {useCallback, useState} from 'react';
import ReactDOM from 'react-dom';
import {string} from 'prop-types';

const HelloMessage = ({name}) => {
const [greeting, setGreeting] = useState('Hello');
23 changes: 23 additions & 0 deletions examples/react/component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {string} from 'prop-types';
import React, {useCallback, useState} from 'react';
import ReactDOM from 'react-dom';

const HelloMessage = ({name}) => {
const [greeting, setGreeting] = useState('Hello');

const onClick = useCallback(() => {
setGreeting(`Goodbye ${name}`);
}, [name]);

return (
<div onClick={onClick}>
{greeting} {name}
</div>
);
};

HelloMessage.propTypes = {
name: string.isRequired,
};

ReactDOM.render(<HelloMessage name="John" />, document.getElementById('root'));
172 changes: 90 additions & 82 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,92 @@
module.exports = {
extends: ['prettier'],
plugins: ['import', 'prettier', 'sort-imports-es6-autofix'],
env: {
node: true,
browser: true,
es6: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
'array-callback-return': 'error',
'block-scoped-var': 'error',
curly: 'error',
'default-case': 'error',
'dot-notation': ['error', {allowPattern: '^[a-z]+(_[a-z]+)+$'}],
eqeqeq: 'error',
'import/default': 'error',
'import/first': 'error',
'import/named': 'error',
'import/no-duplicates': 'error',
'import/no-self-import': 'error',
'import/no-unresolved': ['error', {commonjs: true}],
'no-case-declarations': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-const-assign': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'error',
'no-empty-character-class': 'error',
'no-eq-null': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-inner-declarations': ['error', 'functions'],
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-negated-in-lhs': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'no-param-reassign': 'error',
'no-process-exit': 'off',
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-sparse-arrays': 'error',
'no-undef': 'error',
'no-underscore-dangle': 'off',
'no-unexpected-multiline': 'error',
'no-unreachable': 'error',
'no-unsafe-finally': 'error',
'no-unused-vars': ['error', {ignoreRestSiblings: true}],
'no-use-before-define': ['error', 'nofunc'],
'no-var': 'error',
'prefer-const': 'error',
'prettier/prettier': [
'error',
{
singleQuote: true,
bracketSpacing: false,
trailingComma: 'es5',
arrowParens: 'avoid',
},
],
strict: 'off',
'sort-imports-es6-autofix/sort-imports-es6': [
'error',
{
ignoreCase: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'],
import js from '@eslint/js';
import importPlugin from 'eslint-plugin-import';
import prettier from 'eslint-plugin-prettier';
import globals from 'globals';

export default [
js.configs.recommended,
importPlugin.flatConfigs.recommended,
{
name: 'planet/recommended',
plugins: {
prettier,
},

languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
],
'use-isnan': 'error',
'valid-typeof': 'error',

ecmaVersion: 'latest',
sourceType: 'module',
},

rules: {
// core rules
'array-callback-return': 'error',
'block-scoped-var': 'error',
curly: 'error',
'default-case': 'error',
'dot-notation': ['error', {allowPattern: '^[a-z]+(_[a-z]+)+$'}],
eqeqeq: 'error',
'no-case-declarations': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-const-assign': 'error',
'no-constant-binary-expression': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'error',
'no-empty-character-class': 'error',
'no-eq-null': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-inner-declarations': ['error', 'functions'],
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-negated-in-lhs': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'no-param-reassign': 'error',
'no-process-exit': 'off',
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-sparse-arrays': 'error',
'no-undef': 'error',
'no-underscore-dangle': 'off',
'no-unexpected-multiline': 'error',
'no-unreachable': 'error',
'no-unsafe-finally': 'error',
'no-unused-vars': ['error', {ignoreRestSiblings: true}],
'no-use-before-define': ['error', 'nofunc'],
'no-var': 'error',
'prefer-const': 'error',
strict: 'off',
'use-isnan': 'error',
'valid-typeof': 'error',

// import plugin
'import/default': 'error',
'import/extensions': ['error', 'always', {ignorePackages: true}],
'import/first': 'error',
'import/named': 'error',
'import/no-duplicates': 'error',
'import/no-self-import': 'error',
'import/no-unresolved': ['error', {commonjs: true}],
'import/order': ['error', {named: true, alphabetize: {order: 'asc'}}],

// prettier plugin
'prettier/prettier': [
'error',
{singleQuote: true, bracketSpacing: false, arrowParens: 'avoid'},
],
},
},
};
];
Loading