diff --git a/.eslintrc.js b/.eslintrc.js index c40ae71..9c67a88 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,29 +1 @@ -// Basic .eslintrc.js file that loads the the frontier shared eslint configuration, and then the extension/override provided by the configuration in index.js just for local demonstration purposes. Also contains example `deprecate` rules. -module.exports = { - extends: [ - 'eslint-config-frontier', - 'eslint-config-standard', - // 'plugin:eslint-plugin-sonarjs/recommended' // Disabled globally, for now, because it is a much higher standard than Tree's existing code currently adheres to. Enable on a case-by-case basis, if you wish. - 'plugin:promise/recommended', - './index.js' - ], - plugins: [ - // Enable plugins that are not natively supported by Code Climate. Otherwise results in build errors. - 'eslint-plugin-bestpractices', - 'eslint-plugin-deprecate', - 'eslint-plugin-promise', - 'eslint-plugin-sonarjs', - 'eslint-plugin-test-selectors' // NOTE: Only runs against JSX - ], - rules: { - 'deprecate/function': ['error', - {'name': 'deprecatedFunction', 'use': 'function x from package y'} - ], - 'deprecate/import': ['error', - {'name': 'path/to/legacyModule', 'use': 'module x'} - ], - 'deprecate/member-expression': ['error', - {'name': '$.each', 'use': 'native forEach'} - ] - } -}; +module.exports = { extends: ['./index.js'], settings: { jest: { version: 29 } } } diff --git a/.gitignore b/.gitignore index f246e76..9c677f4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,5 @@ .vscode/* **/node_modules /reports/** -analysis.json npm-debug.log /demo/test/snapshots/local* diff --git a/.npmrc b/.npmrc index 43c97e7..5d7c691 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ package-lock=false +save=true \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..19c7bdb --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +16 \ No newline at end of file diff --git a/README.md b/README.md index 3c68033..e1be8b5 100644 --- a/README.md +++ b/README.md @@ -8,27 +8,30 @@ This central configuration is a potential breaking point for _all_ of our code i **Process:** +1. Run `npm test` (to determine if any significant rules have changed since the last release) + - The tests will likely fail. Verify newly-consumed rules against the current [snapshot](/demo/test/snapshots/linting-config.test.js.md) file. +1. After verifying, run `npm run test:update`. 1. Make dependency/configuration updates. -1. Run `npm test`. +1. Run `npm test` (to determine new changes in linting results or configuration). - The tests should likely fail. Verify your expectations against the current [snapshot](/demo/test/snapshots/linting-config.test.js.md) file. 1. After you have your results how you want them, run `npm run test:update`. - The tests should now pass. -1. If you want see how your changes would impact a codebase, you can either `npm link` or copy+paste the contents of `local-linting-final-config.json` temporarily into the target `.eslintrc` file. -> TODO: Update the documentation below to be current, and not include things like Code Climate + Why extra rules? Because we believe in linting, and we have become converted to the additional rules enforced by the following plugins: - [eslint-plugin-bestpractices](https://github.com/skye2k2/eslint-plugin-bestpractices) - [eslint-plugin-deprecate](https://github.com/AlexMost/eslint-plugin-deprecate) - [eslint-plugin-html](https://github.com/BenoitZugmeyer/eslint-plugin-html) + - [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) (implemented by Frontier) - [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) - - [eslint-plugin-json](https://github.com/azeemba/eslint-plugin-json) + - [eslint-plugin-json](https://github.com/azeemba/eslint-plugin-json) (adopted by Frontier) - [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) - [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs) - - [eslint-config-standard](https://github.com/standard/eslint-config-standard) -> POTENTIALLY WORTH CONSIDERING IN THE FUTURE (MAY NOT WORK BECAUSE OF NEEDING SOMETHING LIKE BABEL?): +> POTENTIALLY WORTH CONSIDERING IN THE FUTURE (MAY NOT WORK BECAUSE OF NEEDING SOMETHING EXTRA?): > - 'eslint-plugin-i18next' // SEEMS LIKE TOO MANY FALSE POSITIVES > - 'eslint-plugin-json-format' // DOESN'T SEEM TO WORK @@ -39,51 +42,17 @@ Why extra rules? Because we believe in linting, and we have become converted to ## Usage: - 1. Add either `eslint-config-frontier` or `eslint-config-frontier-react` as a devDependency. - 1. Add this repository as a package devDependency: - > "eslint-config-tree": "github:fs-webdev/eslint-config-tree#semver:^4", + > "eslint-config-tree": "github:fs-webdev/eslint-config-tree#semver:^6", - 1. In your `eslintrc.js` file, put the following: + 1. Add an `eslintrc.js` file, with the following:
module.exports = {
   extends: [
-    'eslint-config-frontier', // or '@fs/eslint-config-frontier-react'
     'eslint-config-tree'
-  ],
-  plugins: [
-    'eslint-plugin-bestpractices',
-    'eslint-plugin-deprecate',
-    'eslint-plugin-promise',
-    'eslint-plugin-sonarjs',
-    'eslint-plugin-test-selectors'
-  ]
-}
- - 1. Add a `.codeclimate.eslintrc.js` -
module.exports = {
-  extends: [
-    './eslint-config-frontier.js', // or '@fs/eslint-config-frontier-react'
-    './eslint-config-tree.js'
   ]
 }
- 1. Add both `tree` and the frontier eslint configuration of your choice as Code Climate `prepare` resources (see: [extended eslint docs](https://www.familysearch.org/frontier/legacy/ui-components/eslint-config-frontier/)). - - 1. Set this simplified eslint configuration as the chosen config in your Code Climate's `plugins`. -
plugins:
-		eslint:
-			enabled: true
-			channel: "eslint-6"
-			config:
-				config: .codeclimate.eslintrc.js
-			extensions:
-				- .html
-				- .js
-				- .json
-			ignore_warnings: true
- 
- 1. Enjoy. ## HOWTOs: @@ -126,7 +95,7 @@ Utilize a file linting config modifier like so: ``` -Note that `--` comments are permitted and a good idea to include. +Note that `--` comments are permitted and a very good idea to include.