-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add config directory + config tests (#16)
* Setup separate rules and configs diretories * Move test side-by-side to rule * Move lib into src, add devDependencies * Add .nvmrc to version 16 * Add base scripts * Add jest and node types, promise and sonjar plugins, ts-jest * Add cypress config test, add husky hooks * Add recommended tests * Update rule definition and test based on new parser and identifiers * Delete cypress changes (for now) * Remove ts-jest * Fix fixture.json gitignore * use default exports, use more magic in tests * Use JSDoc type * Add node test workflow * Set engines to match other downstream repos (e.g. typescript-eslint, jest) * Expand JSDoc comment
- Loading branch information
1 parent
323b54f
commit 1db9e3b
Showing
15 changed files
with
7,045 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x, 14.x, 16.x, 17.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,133 +1,7 @@ | ||
const rules = require("./lib"); | ||
|
||
const importOrderBaseConfig = { | ||
groups: [["builtin", "external"], "internal", ["parent", "sibling"]], | ||
"newlines-between": "always", | ||
warnOnUnassignedImports: false, | ||
}; | ||
|
||
const importOrder = [ | ||
2, | ||
{ | ||
groups: [["builtin", "external"], "internal", ["parent", "sibling"]], | ||
"newlines-between": "always", | ||
warnOnUnassignedImports: false, | ||
}, | ||
]; | ||
|
||
/** | ||
* TODO: If more distinct rulesets are needed, e.g. `plugin:curology/jest`, | ||
* `plugin:curology/react`, we can expand on the exported config keys. | ||
*/ | ||
const recommended = { | ||
extends: [ | ||
"airbnb", | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["curology"], | ||
rules: { | ||
"@typescript-eslint/prefer-ts-expect-error": 2, | ||
"arrow-parens": 0, | ||
"class-methods-use-this": 0, | ||
"comma-dangle": [2, "always-multiline"], | ||
"consistent-return": 0, | ||
"curology/no-single-letter-variable": 2, | ||
"func-names": 0, | ||
"function-paren-newline": 0, | ||
"global-require": 0, | ||
"id-length": 0, | ||
"import/extensions": [2, "never"], | ||
"import/no-cycle": 1, | ||
"import/no-named-as-default-member": 1, | ||
"import/no-unresolved": 0, | ||
"import/order": [2, { ...importOrderBaseConfig }], | ||
"import/prefer-default-export": 0, | ||
"import/no-extraneous-dependencies": [2, { devDependencies: true }], | ||
indent: 0, | ||
"jsx-a11y/anchor-is-valid": 1, | ||
"jsx-a11y/click-events-have-key-events": 1, | ||
"jsx-a11y/img-redundant-alt": 1, | ||
"jsx-a11y/no-static-element-interactions": 1, | ||
"jsx-a11y/accessible-emoji": 1, | ||
"max-len": 0, | ||
"no-confusing-arrow": 0, | ||
"no-console": 2, | ||
"no-else-return": 1, | ||
"no-plusplus": 1, | ||
"no-static-element-interactions": 0, | ||
"no-underscore-dangle": 1, | ||
"object-curly-newline": 0, | ||
"object-property-newline": [2, { allowAllPropertiesOnSameLine: true }], | ||
"react/function-component-definition": 0, | ||
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }], | ||
"react/jsx-fragments": [2, "element"], | ||
"react/jsx-key": 2, | ||
"react/jsx-no-useless-fragment": 0, | ||
"react/jsx-one-expression-per-line": 0, | ||
"react/jsx-props-no-spreading": 0, | ||
"react/jsx-wrap-multilines": 0, | ||
"react/no-array-index-key": 1, | ||
"react/require-default-props": 2, | ||
"react/sort-comp": 0, | ||
"space-before-function-paren": 0, | ||
}, | ||
settings: { | ||
"import/extensions": [".js", ".jsx", ".ts", ".tsx"], | ||
}, | ||
}; | ||
|
||
const cypress = { | ||
...recommended, | ||
extends: ["plugin:cypress/recommended", ...recommended.extends], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["cypress"], | ||
rules: { | ||
...recommended.rules, | ||
"cypress/no-assigning-return-values": 2, | ||
"cypress/no-unnecessary-waiting": 2, | ||
"cypress/no-async-tests": 2, | ||
"cypress/assertion-before-screenshot": 2, | ||
"cypress/require-data-selectors": 0, | ||
"cypress/no-force": 1, | ||
"cypress/no-pause": 2, | ||
"@typescript-eslint/ban-ts-ignore": 0, | ||
camelcase: 0, | ||
"@typescript-eslint/camelcase": 0, | ||
"@typescript-eslint/explicit-function-return-type": 0, | ||
"@typescript-eslint/no-unused-vars": [ | ||
1, | ||
{ | ||
argsIgnorePattern: "^_", | ||
}, | ||
], | ||
"import/order": [ | ||
2, | ||
{ | ||
...importOrderBaseConfig, | ||
pathGroups: [ | ||
{ | ||
pattern: "{constants,integration,fixtures}/**", | ||
group: "parent", | ||
position: "before", | ||
}, | ||
], | ||
pathGroupsExcludedImportTypes: [], | ||
}, | ||
], | ||
"no-console": "off", // `cypress-log-to-output` makes console usage useful for debugging | ||
}, | ||
env: { | ||
"cypress/globals": true, | ||
}, | ||
}; | ||
const rules = require("./lib/rules"); | ||
const configs = require("./lib/configs"); | ||
|
||
module.exports = { | ||
configs: { | ||
cypress, | ||
recommended, | ||
}, | ||
configs, | ||
rules, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const recommended = require("./recommended"); | ||
|
||
module.exports = { | ||
recommended, | ||
}; |
Oops, something went wrong.