Skip to content

Commit

Permalink
feat: bump dependencies and use typescript for sources
Browse files Browse the repository at this point in the history
breaking change: bump to eslint 8.5.x
  • Loading branch information
amille44420 committed Dec 30, 2021
1 parent 825b641 commit 47d819e
Show file tree
Hide file tree
Showing 14 changed files with 1,055 additions and 568 deletions.
27 changes: 22 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
executors:
node-step:
docker:
- image: circleci/node:14.4.0
- image: circleci/node:16.13.1

jobs:
deps-install:
Expand All @@ -12,16 +12,16 @@ jobs:
- checkout
- restore_cache:
keys:
- yarn-install-node14-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- yarn-install-node14-{{ checksum "package.json" }}
- yarn-install-node14
- yarn-install-node16-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- yarn-install-node16-{{ checksum "package.json" }}
- yarn-install-node16
paths:
- node_modules
- ~/.cache/yarn
- run:
command: yarn install --frozen-lockfile
- save_cache:
key: yarn-install-node14-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
key: yarn-install-node16-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
- ~/.cache/yarn
Expand All @@ -46,6 +46,18 @@ jobs:
at: ~/project
- run: yarn lint:commit:ci

build:
executor: node-step
steps:
- checkout
- attach_workspace:
at: ~/project
- run: yarn build
- persist_to_workspace:
root: ~/project
paths:
- build

publish:
executor: node-step
steps:
Expand All @@ -59,9 +71,13 @@ workflows:
build:
jobs:
- deps-install
- build:
requires:
- deps-install
- code-lint:
requires:
- deps-install
- build
- commit-lint:
requires:
- deps-install
Expand All @@ -74,3 +90,4 @@ workflows:
requires:
- code-lint
- commit-lint
- build
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# dependencies
/node_modules

# build
/build
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [require.resolve('./index'), 'plugin:@typescript-eslint/recommended', 'prettier'],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.ts'],
},
},
},
rules: {
'import/extensions': [
'error',
'always',
{
js: 'never',
ts: 'never',
},
],
},
};
4 changes: 0 additions & 4 deletions .eslintrc.json

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# dependencies
/node_modules

# build
/build
39 changes: 2 additions & 37 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,2 @@
module.exports = {
plugins: ['prettier'],
extends: ['airbnb-base', 'prettier'],
rules: {
'prettier/prettier': 'error',
curly: ['error', 'all'],
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
},
pathGroups: [
{
// Put imported assets last
pattern: '*.{css,gif,jpeg,png,scss,svg}',
patternOptions: {
matchBase: true,
},
group: 'index',
position: 'after',
},
],
},
],
'import/prefer-default-export': ['warn'],
'max-len': ['warn', 120],
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
'no-continue': 'off',
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'no-plusplus': 'off',
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'],
'object-curly-newline': 'off',
'padding-line-between-statements': ['error', { blankLine: 'always', prev: '*', next: 'return' }],
yoda: ['error', 'never', { onlyEquality: true }],
},
};
// eslint-disable-next-line @typescript-eslint/no-var-requires
module.exports = require('./build/base').default;
41 changes: 24 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,47 @@
],
"license": "MIT",
"author": "Adrien Mille <adrien.mille.aer@gmail.com>",
"main": "index.js",
"files": [
"index.js",
"react.js",
"prettier.js"
"prettier.js",
"build"
],
"dependencies": {
"eslint-config-airbnb": "^18.1.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.4"
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0"
},
"devDependencies": {
"@commitlint/cli": "^12.1.1",
"@commitlint/config-conventional": "^12.1.1",
"@commitlint/cli": "^16.0.1",
"@commitlint/config-conventional": "^16.0.0",
"@types/eslint": "^8.2.1",
"@types/node": "^17.0.5",
"@types/prettier": "^2.4.2",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"commitlint-circle": "^1.0.0",
"eslint": "^7.1.0",
"prettier": "^2.0.5",
"semantic-release": "^17.0.8"
"eslint": "^8.5.0",
"prettier": "^2.5.1",
"semantic-release": "^18.0.1",
"typescript": "^4.5.4"
},
"peerDependencies": {
"eslint": "^7.0.0",
"prettier": "^2.0.5"
},
"scripts": {
"lint": "eslint --ignore-path .gitignore --ignore-pattern \"!**/.*\" .",
"lint:fix": "npm run lint -- --fix",
"lint": "eslint .",
"lint:fix": "yarn lint --fix",
"lint:commit": "commitlint",
"lint:commit:ci": "commitlint-circle",
"release": "semantic-release"
"release": "semantic-release",
"build": "yarn tsc"
},
"publishConfig": {
"access": "public"
Expand Down
9 changes: 2 additions & 7 deletions prettier.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
module.exports = {
trailingComma: 'es5',
printWidth: 120,
tabWidth: 4,
singleQuote: true,
arrowParens: 'avoid',
};
// eslint-disable-next-line @typescript-eslint/no-var-requires
module.exports = require('./build/prettier').default;
37 changes: 2 additions & 35 deletions react.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,2 @@
const { rules } = require('./index');

module.exports = {
plugins: ['prettier', 'react-hooks'],
extends: ['airbnb', 'prettier'],
rules: {
...rules,
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['to'],
aspects: ['noHref', 'invalidHref', 'preferButton'],
},
],
'jsx-quotes': ['error', 'prefer-double'],
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'react/jsx-indent': ['error', 4],
'react/jsx-indent-props': ['error', 4],
'react/jsx-no-useless-fragment': 'error',
'react/jsx-on-expression-per-line': 'off',
'react/jsx-props-no-spreading': 'off',
'react/jsx-sort-default-props': 'error',
'react/jsx-sort-props': [
'error',
{
reservedFirst: true,
shorthandLast: true,
},
],
'react/require-default-props': 'off',
'react/sort-prop-types': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
};
// eslint-disable-next-line @typescript-eslint/no-var-requires
module.exports = require('./build/react').default;
41 changes: 41 additions & 0 deletions src/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Linter } from 'eslint';

const config: Linter.Config = {
plugins: ['prettier'],
extends: ['airbnb-base', 'prettier'],
rules: {
'prettier/prettier': 'error',
curly: ['error', 'all'],
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
},
pathGroups: [
{
// Put imported assets last
pattern: '*.{css,gif,jpeg,png,scss,svg}',
patternOptions: {
matchBase: true,
},
group: 'index',
position: 'after',
},
],
},
],
'import/prefer-default-export': ['warn'],
'max-len': ['warn', 120],
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
'no-continue': 'off',
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'no-plusplus': 'off',
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'],
'object-curly-newline': 'off',
'padding-line-between-statements': ['error', { blankLine: 'always', prev: '*', next: 'return' }],
yoda: ['error', 'never', { onlyEquality: true }],
},
};

export default config;
11 changes: 11 additions & 0 deletions src/prettier.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Options } from 'prettier';

const config: Options = {
trailingComma: 'es5',
printWidth: 120,
tabWidth: 4,
singleQuote: true,
arrowParens: 'avoid',
};

export default config;
38 changes: 38 additions & 0 deletions src/react.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Linter } from 'eslint';
import baseConfig from './base';

const config: Linter.Config = {
plugins: ['prettier', 'react-hooks'],
extends: ['airbnb', 'prettier'],
rules: {
...baseConfig.rules,
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['to'],
aspects: ['noHref', 'invalidHref', 'preferButton'],
},
],
'jsx-quotes': ['error', 'prefer-double'],
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'react/jsx-indent': ['error', 4],
'react/jsx-indent-props': ['error', 4],
'react/jsx-no-useless-fragment': 'error',
'react/jsx-on-expression-per-line': 'off',
'react/jsx-props-no-spreading': 'off',
'react/jsx-sort-default-props': 'error',
'react/jsx-sort-props': [
'error',
{
reservedFirst: true,
shorthandLast: true,
},
],
'react/require-default-props': 'off',
'react/sort-prop-types': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
};

export default config;
Loading

0 comments on commit 47d819e

Please sign in to comment.