Has anyone used `turborepos` with SST? I’ve been ...
# sst
a
Has anyone used
turborepos
with SST? I’ve been using it on a number of projects and it brought lots of benefits both for dev and CI. I’ve been working with it on an SST project and NextJSSite but it has highlighted a number of complexities/diversions from practices in other projects. It would be great to be able to use this or other such solutions to speed up the build step for NextJSSites currently it is built twice on every deploy. Could SST leverage the build hashes to prevent this? Also the
cwd
during the build process and also the loading of additional next and eslint config causes some issues or at least confusion and I can’t find a way to resolve this.
d
also the loading of additional next and eslint config causes some issues or at least confusion and I can’t find a way to resolve this.
https://nextjs.org/docs/basic-features/eslint
a
The issue that I need to articulate slightly better. The next eslint config is loaded but when running sst lint the cwd is not as expected and the eslint can not locate the pages directory
d
where is it located with regards to SST, and what do you have set for the
path
param of
sst.NextjsSiteProps
?
a
I have a number of apps and I’m exploring using monorepo tooling which may be causing some of the complexity so I’m tripping everything back and looking at each individual aspect. But in this particular context I have multiple NextJs apps in ./apps/* and for example I have a path set as apps/admin.
s
i tend to follow the strategy of having a bespoke eslint configuration and then disabling built in eslint configs on all tools (e.g. sst, next, etc). i feel this gives me much more control and consistency, whilst also speeding up tooling to some degree in certain contexts.
For example, here are the respective entries in my root package.json...
Copy code
{
  "scripts": {
    "lint": "eslint --ext .ts,.tsx,.js --ignore-path .gitignore .",
    "lint:fix": "yarn lint --fix"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.9.0",
    "@typescript-eslint/parser": "^5.9.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^8.6.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-config-react-app": "^7.0.0",
    "eslint-plugin-flowtype": "^8.0.3",
    "eslint-plugin-import": "^2.25.4",
    "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",
    "eslint-plugin-simple-import-sort": "^7.0.0",
    "prettier": "^2.5.1",
    "typescript": "^4.5.4"
  },
  "eslintConfig": {
    "root": true,
    "extends": [
      "react-app",
      "prettier"
    ],
    "plugins": [
      "prettier",
      "simple-import-sort"
    ],
    "rules": {
      "prettier/prettier": "error",
      "simple-import-sort/imports": "error",
      "simple-import-sort/exports": "error"
    },
    "overrides": [
      {
        "files": [
          "**/__tests__/*.ts?(x)",
          "**/*.test.ts?(x)"
        ],
        "env": {
          "jest": true
        }
      }
    ]
  },
  "prettier": {
    "tabWidth": 2,
    "useTabs": false,
    "trailingComma": "all"
  }
}
I use the eslint preset from Create React App as I find it quite pragmatic, even though there is no Create React App instance in my application. 😅 Works really well with my lambdas and Next.js setup.
d
@Alistair Stead, did you ever figure this out? I just added a NextJsSite to a turborepo, and am getting two builds.
Actually, turning off linting seemed to fix.